]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-gui.sh
git-gui: Don't quit when we destroy a child widget
[git.git] / git-gui.sh
index 40f54e4dab677f5dfd556a089d3d5de136f50e5d..a8185a3014d4f10f11efe9ff7b917b89fc07cf03 100755 (executable)
@@ -25,7 +25,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA}
 ## configure our library
 
 set oguilib {@@GITGUI_LIBDIR@@}
-if {[string match @@GITGUI_*@@ $oguilib]} {
+set oguirel {@@GITGUI_RELATIVE@@}
+if {$oguirel eq {1}} {
+       set oguilib [file dirname [file dirname [file normalize $argv0]]]
+       set oguilib [file join $oguilib share git-gui lib]
+} elseif {[string match @@* $oguirel]} {
        set oguilib [file join [file dirname [file normalize $argv0]] lib]
 }
 set idx [file join $oguilib tclIndex]
@@ -55,7 +59,7 @@ if {$idx ne {}} {
 } else {
        set auto_path [concat [list $oguilib] $auto_path]
 }
-unset -nocomplain fd idx
+unset -nocomplain oguilib oguirel idx fd
 
 if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
        unset _verbose
@@ -1206,15 +1210,12 @@ foreach class {Button Checkbutton Entry Label
 }
 unset class
 
-if {[is_Windows]} {
-       set M1B Control
-       set M1T Ctrl
-} elseif {[is_MacOSX]} {
+if {[is_MacOSX]} {
        set M1B M1
        set M1T Cmd
 } else {
-       set M1B M1
-       set M1T M1
+       set M1B Control
+       set M1T Ctrl
 }
 
 proc apply_config {} {
@@ -1599,7 +1600,7 @@ unset browser doc_path doc_url
 
 # -- Standard bindings
 #
-bind .   <Destroy> do_quit
+bind .   <Destroy> {if {{%W} eq {.}} 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]}
@@ -2037,17 +2038,17 @@ lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
 $ctxm add separator
 $ctxm add command \
        -label {Show Less Context} \
-       -command {if {$repo_config(gui.diffcontext) >= 2} {
+       -command {if {$repo_config(gui.diffcontext) >= 1} {
                incr repo_config(gui.diffcontext) -1
                reshow_diff
        }}
 lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
 $ctxm add command \
        -label {Show More Context} \
-       -command {
+       -command {if {$repo_config(gui.diffcontext) < 99} {
                incr repo_config(gui.diffcontext)
                reshow_diff
-       }
+       }}
 lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
 $ctxm add separator
 $ctxm add command -label {Options...} \