git-gui: Misc. bug fixes for mouse click crashes.
Make sure the file_lists array has both elements set at all times, otherwise we get Tcl errors during mouse clicks in the file list areas due to the list not being defined. Also added M1-A as a keyboard binding within the console window text area. This lets users select all text easily and copy it to the clipboard. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 11, 2006 at 20:00 UTC
62aac80b133de4fa004d90d27a97f574aec9d02d
1 file changed
+10
-3
git-gui
+10
-3
@@ -960,7 +960,9 @@ proc display_all_files {} {
960
$ui_index delete 0.0 end
961
$ui_other delete 0.0 end
962
963
- array unset file_lists
963
+ set file_lists($ui_index) [list]
964
+ set file_lists($ui_other) [list]
965
+
966
foreach path [lsort [array names file_states]] {
967
set s $file_states($path)
968
set m [lindex $s 0]
@@ -1273,7 +1275,7 @@ proc new_console {short_title long_title} {
1275
1276
proc console_init {w} {
1277
global console_cr console_data
1276
- global gitdir appname font_ui font_diff
1278
+ global gitdir appname font_ui font_diff M1B
1279
1280
set console_cr($w) 1.0
1281
toplevel $w
@@ -1306,6 +1308,8 @@ proc console_init {w} {
1308
-command "destroy $w"
1309
pack $w.ok -side bottom
1310
1311
+ bind $w.m.t <$M1B-Key-a> "$w.m.t tag add sel 0.0 end;break"
1312
+ bind $w.m.t <$M1B-Key-A> "$w.m.t tag add sel 0.0 end;break"
1313
bind $w <Visibility> "focus $w"
1314
wm title $w "$appname ([lindex [file split \
1315
[file normalize [file dirname $gitdir]]] \
@@ -1900,7 +1904,10 @@ foreach i [list $ui_index $ui_other] {
1904
bind $i <Button-3> {click %W %x %y 3 %X %Y; break}
1905
bind $i <ButtonRelease-1> {unclick %W %x %y; break}
1906
}
1903
-unset i M1B M1T
1907
+unset i
1908
+
1909
+set file_lists($ui_index) [list]
1910
+set file_lists($ui_other) [list]
1911
1912
wm title . "$appname ([file normalize [file dirname $gitdir]])"
1913
focus -force $ui_comm