git-gui: incremental goto line in blame view
The view jumps now to the given line number after each key press. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Bert Wesarg committed
Oct 13, 2011 at 15:48 UTC
843d6597fbacfae02b8af7d6840992c92d0863f8
1 file changed
+11
-4
lib/line.tcl
+11
-4
@@ -20,7 +20,7 @@ constructor new {i_w i_text args} {
20
-background lightgreen \
21
-validate key \
22
-validatecommand [cb _validate %P]
23
- ${NS}::button $w.bn -text [mc Go] -command [cb _incrgoto]
23
+ ${NS}::button $w.bn -text [mc Go] -command [cb _goto]
24
25
pack $w.l -side left
26
pack $w.bn -side right
@@ -29,7 +29,8 @@ constructor new {i_w i_text args} {
29
eval grid conf $w -sticky we $args
30
grid remove $w
31
32
- bind $w.ent <Return> [cb _incrgoto]
32
+ trace add variable linenum write [cb _goto_cb]
33
+ bind $w.ent <Return> [cb _goto]
34
bind $w.ent <Escape> [cb hide]
35
36
bind $w <Destroy> [list delete_this $this]
@@ -64,10 +65,16 @@ method _validate {P} {
65
string is integer $P
66
}
67
67
-method _incrgoto {} {
68
+method _goto_cb {name ix op} {
69
+ after idle [cb _goto 1]
70
+}
71
+
72
+method _goto {{nohide {0}}} {
73
if {$linenum ne {}} {
74
$ctext see $linenum.0
70
- hide $this
75
+ if {!$nohide} {
76
+ hide $this
77
+ }
78
}
79
}
80