Skip to content

Commit 70336bd

Browse files
committed
Merge branch 'py/git-gui-do-quit'
"git gui" learned to call the clean-up procedure before exiting. * py/git-gui-do-quit: git-gui: call do_quit before destroying the main window
2 parents 745f681 + 0d88f3d commit 70336bd

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

git-gui/git-gui.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,8 +3030,23 @@ unset doc_path doc_url
30303030
wm protocol . WM_DELETE_WINDOW do_quit
30313031
bind all <$M1B-Key-q> do_quit
30323032
bind all <$M1B-Key-Q> do_quit
3033-
bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
3034-
bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
3033+
3034+
set m1b_w_script {
3035+
set toplvl_win [winfo toplevel %W]
3036+
3037+
# If we are destroying the main window, we should call do_quit to take
3038+
# care of cleanup before exiting the program.
3039+
if {$toplvl_win eq "."} {
3040+
do_quit
3041+
} else {
3042+
destroy $toplvl_win
3043+
}
3044+
}
3045+
3046+
bind all <$M1B-Key-w> $m1b_w_script
3047+
bind all <$M1B-Key-W> $m1b_w_script
3048+
3049+
unset m1b_w_script
30353050
30363051
set subcommand_args {}
30373052
proc usage {} {

0 commit comments

Comments
 (0)