Skip to content

Commit 843d659

Browse files
bertwesargpatthoyts
authored andcommitted
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>
1 parent 81a92e5 commit 843d659

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/line.tcl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ constructor new {i_w i_text args} {
2020
-background lightgreen \
2121
-validate key \
2222
-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]
2424

2525
pack $w.l -side left
2626
pack $w.bn -side right
@@ -29,7 +29,8 @@ constructor new {i_w i_text args} {
2929
eval grid conf $w -sticky we $args
3030
grid remove $w
3131

32-
bind $w.ent <Return> [cb _incrgoto]
32+
trace add variable linenum write [cb _goto_cb]
33+
bind $w.ent <Return> [cb _goto]
3334
bind $w.ent <Escape> [cb hide]
3435

3536
bind $w <Destroy> [list delete_this $this]
@@ -64,10 +65,16 @@ method _validate {P} {
6465
string is integer $P
6566
}
6667

67-
method _incrgoto {} {
68+
method _goto_cb {name ix op} {
69+
after idle [cb _goto 1]
70+
}
71+
72+
method _goto {{nohide {0}}} {
6873
if {$linenum ne {}} {
6974
$ctext see $linenum.0
70-
hide $this
75+
if {!$nohide} {
76+
hide $this
77+
}
7178
}
7279
}
7380

0 commit comments

Comments
 (0)