734
global varcid varccommits varcrow curview cached_commitrow
735
global varctok vtokmod
736
737
- if {[info exists cached_commitrow($id)]} {
738
- return $cached_commitrow($id)
739
- }
737
set v $curview
738
if {![info exists varcid($v,$id)]} {
739
puts "oops rowofcommit no arc for [shortids $id]"
743
if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] >= 0} {
744
update_arcrows $v
745
}
746
+ if {[info exists cached_commitrow($id)]} {
747
+ return $cached_commitrow($id)
748
+ }
749
set i [lsearch -exact $varccommits($v,$a) $id]
750
if {$i < 0} {
751
puts "oops didn't find commit [shortids $id] in arc $a"
1299
}
1300
1301
proc makewindow {} {
1302
- global canv canv2 canv3 linespc charspc ctext cflist
1302
+ global canv canv2 canv3 linespc charspc ctext cflist cscroll
1303
global tabstop
1304
global findtype findtypemenu findloc findstring fstring geometry
1305
global entries sha1entry sha1string sha1but
1774
1775
proc scrollcanv {cscroll f0 f1} {
1776
$cscroll set $f0 $f1
1777
- drawfrac $f0 $f1
1777
+ drawvisible
1778
flushhighlights
1779
}
1780
4538
}
4539
}
4540
4541
-proc drawfrac {f0 f1} {
4542
- global canv linespc
4541
+proc drawvisible {} {
4542
+ global canv linespc curview vrowmod selectedline targetrow targetid
4543
+ global need_redisplay cscroll
4544
4545
+ set fs [$canv yview]
4546
set ymax [lindex [$canv cget -scrollregion] 3]
4547
if {$ymax eq {} || $ymax == 0} return
4548
+ set f0 [lindex $fs 0]
4549
+ set f1 [lindex $fs 1]
4550
set y0 [expr {int($f0 * $ymax)}]
4547
- set row [expr {int(($y0 - 3) / $linespc) - 1}]
4551
set y1 [expr {int($f1 * $ymax)}]
4552
+
4553
+ if {[info exists targetid]} {
4554
+ set r [rowofcommit $targetid]
4555
+ if {$r != $targetrow} {
4556
+ # Fix up the scrollregion and change the scrolling position
4557
+ # now that our target row has moved.
4558
+ set diff [expr {($r - $targetrow) * $linespc}]
4559
+ set targetrow $r
4560
+ setcanvscroll
4561
+ set ymax [lindex [$canv cget -scrollregion] 3]
4562
+ incr y0 $diff
4563
+ incr y1 $diff
4564
+ set f0 [expr {$y0 / $ymax}]
4565
+ set f1 [expr {$y1 / $ymax}]
4566
+ allcanvs yview moveto $f0
4567
+ $cscroll set $f0 $f1
4568
+ set need_redisplay 1
4569
+ }
4570
+ }
4571
+
4572
+ set row [expr {int(($y0 - 3) / $linespc) - 1}]
4573
set endrow [expr {int(($y1 - 3) / $linespc) + 1}]
4574
+ if {$endrow >= $vrowmod($curview)} {
4575
+ update_arcrows $curview
4576
+ }
4577
+ if {[info exists selectedline] &&
4578
+ $row <= $selectedline && $selectedline <= $endrow} {
4579
+ set targetrow $selectedline
4580
+ } else {
4581
+ set targetrow [expr {int(($row + $endrow) / 2)}]
4582
+ }
4583
+ set targetid [commitonrow $targetrow]
4584
drawcommits $row $endrow
4585
}
4586
4553
-proc drawvisible {} {
4554
- global canv
4555
- eval drawfrac [$canv yview]
4556
-}
4557
-
4587
proc clear_display {} {
4588
global iddrawn linesegs need_redisplay nrows_drawn
4589
global vhighlights fhighlights nhighlights rhighlights