From a13ee29b975d3a9a012983309e842d942b2bbd44 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 2 Aug 2007 22:55:22 -0400 Subject: git-gui: Avoid Tcl error in popup menu on diff viewer If there is no path currently shown in the diff viewer then we were getting Tcl errors anytime the user right-clicked on the diff viewer to bring up its popup menu. The bug here is caused by trying to get the file_state for the empty string; this path is never seen so we never have file_state for it. In such cases we now disable the Stage Hunk For Commit option. Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index 671b887..2c7eb3c 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2407,13 +2407,15 @@ $ctxm add separator $ctxm add command -label {Options...} \ -command do_options proc popup_diff_menu {ctxm x y X Y} { + global current_diff_path set ::cursorX $x set ::cursorY $y if {$::ui_index eq $::current_diff_side} { $ctxm entryconf $::ui_diff_applyhunk \ -state normal \ -label {Unstage Hunk From Commit} - } elseif {{_O} eq [lindex $::file_states($::current_diff_path) 0]} { + } elseif {![info exists file_states($current_diff_path)] + || {_O} eq [lindex $file_states($::current_diff_path) 0]} { $ctxm entryconf $::ui_diff_applyhunk \ -state disabled \ -label {Stage Hunk For Commit} -- cgit v0.10.2-6-g49f6 From 51b8c5021a19195e0f138832b081a356a2247bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A4in=C3=B6=20J=C3=A4rvel=C3=A4?= Date: Fri, 3 Aug 2007 12:27:39 +0300 Subject: git-gui: Added support for OS X right click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OS X sends Button-2 on a "real" right click, such as with a three button mouse, or by using the two-finger trackpad click. Signed-off-by: Väinö Järvelä Signed-off-by: Shawn O. Pearce diff --git a/git-gui.sh b/git-gui.sh index 2c7eb3c..29a790e 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1348,6 +1348,9 @@ unset i proc bind_button3 {w cmd} { bind $w $cmd if {[is_MacOSX]} { + # Mac OS X sends Button-2 on right click through three-button mouse, + # or through trackpad right-clicking (two-finger touch + click). + bind $w $cmd bind $w $cmd } } -- cgit v0.10.2-6-g49f6