Skip to content

Commit

Permalink
git-gui: Fix accidental staged state toggle when clicking top pixel row
Browse files Browse the repository at this point in the history
If a text widget is asked the index at x,y with y == 0 or y == 1 it will
always return 1.0 as the nearest index, regardless of the x position.

This means that clicking the top 2 pixels of the Unstaged/Staged Changes
lists caused the state of the file there to be toggled. This patch
checks that the pixel clicked is greater than 1, so there is less chance
of accidentally staging or unstaging changes.

Signed-off-by: Richard Quirk <richard.quirk@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  • Loading branch information
Richard Quirk authored and Shawn O. Pearce committed Jun 21, 2008
1 parent 8a965b8 commit cead78e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ proc toggle_or_diff {w x y} {
$ui_index tag remove in_sel 0.0 end
$ui_workdir tag remove in_sel 0.0 end
if {$col == 0} {
if {$col == 0 && $y > 1} {
set i [expr {$lno-1}]
set ll [expr {[llength $file_lists($w)]-1}]
Expand Down

0 comments on commit cead78e

Please sign in to comment.