aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-09-09 12:26:35 -0700
committerJunio C Hamano <gitster@pobox.com>2019-09-09 12:26:35 -0700
commit70336bd50ad5c17d5aa8f95de4d03888d399adab (patch)
treef7c0b73640aa9a37edab854a710a3a6beca5e17a
parentFirst batch after Git 2.23 (diff)
parentMerge branch 'py/call-do-quit-before-exit' of github.com:gitster/git-gui into... (diff)
downloadgit-70336bd50ad5c17d5aa8f95de4d03888d399adab.tar.gz
git-70336bd50ad5c17d5aa8f95de4d03888d399adab.zip
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
-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 6de74ce639..6ec562d5da 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 {} {