gitk: Fix problem with target row not being in scroll region
Since we limit the rate at which we do updates to the canvas scrolling regions, it's possible to get into selectline for a row that is outside the currently-set scrolling region. When this happens, selectline can't scroll to show the selected line, and as a consequence, drawvisible chooses some other bogus row to be the target row. This fixes it by calling setcanvscroll from selectline in this case. We also set selectedline (and currentid) before calling drawvisible so that drawvisible makes the right choice of target row. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Mar 7, 2008 at 22:51 UTC
c30acc77fec6b7d793af703c4700f5162db82eb7
1 file changed
+6
-3
gitk
+6
-3
@@ -5429,7 +5429,7 @@ proc selectline {l isnew} {
5429
global commentend idtags linknum
5430
global mergemax numcommits pending_select
5431
global cmitmode showneartags allcommits
5432
- global targetrow targetid
5432
+ global targetrow targetid lastscrollrows
5433
5434
catch {unset pending_select}
5435
$canv delete hover
@@ -5440,6 +5440,11 @@ proc selectline {l isnew} {
5440
set id [commitonrow $l]
5441
set targetid $id
5442
set targetrow $l
5443
+ set selectedline $l
5444
+ set currentid $id
5445
+ if {$lastscrollrows < $numcommits} {
5446
+ setcanvscroll
5447
+ }
5448
5449
set y [expr {$canvy0 + $l * $linespc}]
5450
set ymax [lindex [$canv cget -scrollregion] 3]
@@ -5483,8 +5488,6 @@ proc selectline {l isnew} {
5488
addtohistory [list selbyid $id]
5489
}
5490
5486
- set selectedline $l
5487
- set currentid $id
5491
$sha1entry delete 0 end
5492
$sha1entry insert 0 $id
5493
$sha1entry selection from 0