git-gui: Simplified format of geometry configuration.
The gui.geometry config value was starting to contain
the odd string \\{ as part of its value due to the
way the Tcl lists were being supplied to git repo-config.
Now we write out only three values: the overall window
geomtry, the y position of the horizontal sash, and
the x position of the vertical sash.  All other data is
skipped, which makes the gui.geometry value simpler.
While debugging this I noticed that the save_my_config
procedure was being invoked multiple times during exit
due to do_quit getting invoked over and over again.  So
now we set a flag in do_quit and don't perform any of our
"at exit" type of logic if we've already been through the
do_quit procedure once.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
			
			
This commit is contained in:
		
							
								
								
									
										27
									
								
								git-gui
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								git-gui
									
									
									
									
									
								
							| @ -48,11 +48,9 @@ proc save_my_config {} { | |||||||
| 		set repo_config(gui.trustmtime) [list $cfg_trust_mtime] | 		set repo_config(gui.trustmtime) [list $cfg_trust_mtime] | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	set cfg_geometry [list \ | 	set cfg_geometry [wm geometry .] | ||||||
| 		[wm geometry .] \ | 	append cfg_geometry " [lindex [.vpane sash coord 0] 1]" | ||||||
| 		[.vpane sash coord 0] \ | 	append cfg_geometry " [lindex [.vpane.files sash coord 0] 0]" | ||||||
| 		[.vpane.files sash coord 0] \ |  | ||||||
| 		] |  | ||||||
| 	if {[catch {set rc_geometry $repo_config(gui.geometry)}]} { | 	if {[catch {set rc_geometry $repo_config(gui.geometry)}]} { | ||||||
| 		set rc_geometry [list [list]] | 		set rc_geometry [list [list]] | ||||||
| 	} | 	} | ||||||
| @ -1422,8 +1420,13 @@ proc do_repack {} { | |||||||
| 	console_exec $w $cmd | 	console_exec $w $cmd | ||||||
| } | } | ||||||
|  |  | ||||||
|  | set quitting 0 | ||||||
|  |  | ||||||
| proc do_quit {} { | proc do_quit {} { | ||||||
| 	global gitdir ui_comm | 	global gitdir ui_comm quitting | ||||||
|  |  | ||||||
|  | 	if {$quitting} return | ||||||
|  | 	set quitting 1 | ||||||
|  |  | ||||||
| 	set save [file join $gitdir GITGUI_MSG] | 	set save [file join $gitdir GITGUI_MSG] | ||||||
| 	set msg [string trim [$ui_comm get 0.0 end]] | 	set msg [string trim [$ui_comm get 0.0 end]] | ||||||
| @ -1837,10 +1840,16 @@ pack .status -anchor w -side bottom -fill x | |||||||
|  |  | ||||||
| # -- Load geometry | # -- Load geometry | ||||||
| catch { | catch { | ||||||
| wm geometry . [lindex $repo_config(gui.geometry) 0 0] | set gm [lindex $repo_config(gui.geometry) 0] | ||||||
| eval .vpane sash place 0 [lindex $repo_config(gui.geometry) 0 1] | wm geometry . [lindex $gm 0] | ||||||
| eval .vpane.files sash place 0 [lindex $repo_config(gui.geometry) 0 2] | .vpane sash place 0 \ | ||||||
|  | 	[lindex [.vpane sash coord 0] 0] \ | ||||||
|  | 	[lindex $gm 1] | ||||||
|  | .vpane.files sash place 0 \ | ||||||
|  | 	[lindex $gm 2] \ | ||||||
|  | 	[lindex [.vpane.files sash coord 0] 1] | ||||||
| } | } | ||||||
|  | unset gm | ||||||
|  |  | ||||||
| # -- Key Bindings | # -- Key Bindings | ||||||
| bind $ui_comm <$M1B-Key-Return> {do_commit;break} | bind $ui_comm <$M1B-Key-Return> {do_commit;break} | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Shawn O. Pearce
					Shawn O. Pearce