@matheusbsbs / matheus-bagliano / commits / 833eda736a
Fork 0

git-gui: Only permit selection in one list at a time.

Now that our lists represent more defined states it no longer makes any sense to permit a user to make selections from both lists at once, as the each available operation acts only on files whose status corresponds to only one of the lists. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jan 20, 2007 at 23:46 UTC 833eda736ad1ec99c30b2c4d7a565ccc406c97a0
1 file changed +11 -10
git-gui.sh
+11 -10
@@ -1355,7 +1355,7 @@ proc display_all_files_helper {w path icon_name m} {
1355 proc display_all_files {} {
1356 global ui_index ui_workdir
1357 global file_states file_lists
1358 - global last_clicked selected_paths
1358 + global last_clicked
1359
1360 $ui_index conf -state normal
1361 $ui_workdir conf -state normal
@@ -2852,18 +2852,21 @@ proc toggle_or_diff {w x y} {
2852 }
2853
2854 proc add_one_to_selection {w x y} {
2855 - global file_lists
2856 - global last_clicked selected_paths
2855 + global file_lists last_clicked selected_paths
2856
2858 - set pos [split [$w index @$x,$y] .]
2859 - set lno [lindex $pos 0]
2860 - set col [lindex $pos 1]
2857 + set lno [lindex [split [$w index @$x,$y] .] 0]
2858 set path [lindex $file_lists($w) [expr {$lno - 1}]]
2859 if {$path eq {}} {
2860 set last_clicked {}
2861 return
2862 }
2863
2864 + if {$last_clicked ne {}
2865 + && [lindex $last_clicked 0] ne $w} {
2866 + array unset selected_paths
2867 + [lindex $last_clicked 0] tag remove in_sel 0.0 end
2868 + }
2869 +
2870 set last_clicked [list $w $lno]
2871 if {[catch {set in_sel $selected_paths($path)}]} {
2872 set in_sel 0
@@ -2878,16 +2881,14 @@ proc add_one_to_selection {w x y} {
2881 }
2882
2883 proc add_range_to_selection {w x y} {
2881 - global file_lists
2882 - global last_clicked selected_paths
2884 + global file_lists last_clicked selected_paths
2885
2886 if {[lindex $last_clicked 0] ne $w} {
2887 toggle_or_diff $w $x $y
2888 return
2889 }
2890
2889 - set pos [split [$w index @$x,$y] .]
2890 - set lno [lindex $pos 0]
2891 + set lno [lindex [split [$w index @$x,$y] .] 0]
2892 set lc [lindex $last_clicked 1]
2893 if {$lc < $lno} {
2894 set begin $lc