summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-08-07 20:26:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-08-07 20:26:06 (GMT)
commit0d88f3d2c54e512570a779c0cafff9801b8c3391 (patch)
tree65dff94596b6a26a287862332e79adc4760fcef3 /git-gui
parent7c20df84bd21ec0215358381844274fa10515017 (diff)
parent5440eb0ea2651c45a0e46f2335ecbb8d1f42c584 (diff)
downloadgit-0d88f3d2c54e512570a779c0cafff9801b8c3391.zip
git-0d88f3d2c54e512570a779c0cafff9801b8c3391.tar.gz
git-0d88f3d2c54e512570a779c0cafff9801b8c3391.tar.bz2
Merge branch 'py/call-do-quit-before-exit' of github.com:gitster/git-gui into py/git-gui-do-quit
* 'py/call-do-quit-before-exit' of github.com:gitster/git-gui: git-gui: call do_quit before destroying the main window
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui/git-gui.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 6de74ce..6ec562d 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -3030,8 +3030,23 @@ unset doc_path doc_url
wm protocol . WM_DELETE_WINDOW do_quit
bind all <$M1B-Key-q> do_quit
bind all <$M1B-Key-Q> do_quit
-bind all <$M1B-Key-w> {destroy [winfo toplevel %W]}
-bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
+
+set m1b_w_script {
+ set toplvl_win [winfo toplevel %W]
+
+ # If we are destroying the main window, we should call do_quit to take
+ # care of cleanup before exiting the program.
+ if {$toplvl_win eq "."} {
+ do_quit
+ } else {
+ destroy $toplvl_win
+ }
+}
+
+bind all <$M1B-Key-w> $m1b_w_script
+bind all <$M1B-Key-W> $m1b_w_script
+
+unset m1b_w_script
set subcommand_args {}
proc usage {} {