161
}
162
163
proc getcommits {} {
164
- global canv curview
164
+ global canv curview need_redisplay
165
166
initlayout
167
start_rev_list $curview
168
show_status [mc "Reading commits..."]
169
+ set need_redisplay 1
170
}
171
172
proc updatecommits {} {
1049
adjustprogress
1050
}
1051
if {$view == $curview} {
1051
- run chewcommits $view
1052
+ run chewcommits
1053
}
1054
return 0
1055
}
1184
set gotsome 1
1185
}
1186
if {$gotsome} {
1186
- run chewcommits $view
1187
+ global numcommits hlview
1188
+
1189
+ if {$view == $curview} {
1190
+ set numcommits $commitidx($view)
1191
+ run chewcommits
1192
+ }
1193
+ if {[info exists hlview] && $view == $hlview} {
1194
+ # we never actually get here...
1195
+ run vhighlightmore
1196
+ }
1197
foreach s $scripts {
1198
eval $s
1199
}
1228
return 2
1229
}
1230
1221
-proc chewcommits {view} {
1231
+proc chewcommits {} {
1232
global curview hlview viewcomplete
1233
global pending_select
1234
1225
- if {$view == $curview} {
1226
- layoutmore
1227
- if {$viewcomplete($view)} {
1228
- global commitidx varctok
1229
- global numcommits startmsecs
1230
- global mainheadid commitinfo nullid
1231
-
1232
- if {[info exists pending_select]} {
1233
- set row [first_real_row]
1234
- selectline $row 1
1235
- }
1236
- if {$commitidx($curview) > 0} {
1237
- #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
1238
- #puts "overall $ms ms for $numcommits commits"
1239
- #puts "[llength $varctok($view)] arcs, $commitidx($view) commits"
1240
- } else {
1241
- show_status [mc "No commits selected"]
1242
- }
1243
- notbusy layout
1235
+ layoutmore
1236
+ if {$viewcomplete($curview)} {
1237
+ global commitidx varctok
1238
+ global numcommits startmsecs
1239
+ global mainheadid commitinfo nullid
1240
+
1241
+ if {[info exists pending_select]} {
1242
+ set row [first_real_row]
1243
+ selectline $row 1
1244
}
1245
- }
1246
- if {[info exists hlview] && $view == $hlview} {
1247
- vhighlightmore
1245
+ if {$commitidx($curview) > 0} {
1246
+ #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
1247
+ #puts "overall $ms ms for $numcommits commits"
1248
+ #puts "[llength $varctok($view)] arcs, $commitidx($view) commits"
1249
+ } else {
1250
+ show_status [mc "No commits selected"]
1251
+ }
1252
+ notbusy layout
1253
}
1254
return 0
1255
}
3069
}
3070
}
3071
set vhl_done $max
3072
+ return 0
3073
}
3074
3075
proc askvhighlight {row id} {
3568
set canvxmax [$canv cget -width]
3569
catch {unset colormap}
3570
catch {unset rowtextx}
3571
+ setcanvscroll
3572
}
3573
3574
proc setcanvscroll {} {
3575
global canv canv2 canv3 numcommits linespc canvxmax canvy0
3576
+ global lastscrollset lastscrollrows
3577
3578
set ymax [expr {$canvy0 + ($numcommits - 0.5) * $linespc + 2}]
3579
$canv conf -scrollregion [list 0 0 $canvxmax $ymax]
3580
$canv2 conf -scrollregion [list 0 0 0 $ymax]
3581
$canv3 conf -scrollregion [list 0 0 0 $ymax]
3582
+ set lastscrollset [clock clicks -milliseconds]
3583
+ set lastscrollrows $numcommits
3584
}
3585
3586
proc visiblerows {} {
3605
proc layoutmore {} {
3606
global commitidx viewcomplete curview
3607
global numcommits pending_select selectedline curview
3598
- global lastscrollset commitinterest
3599
-
3600
- set canshow $commitidx($curview)
3601
- if {$canshow <= $numcommits && !$viewcomplete($curview)} return
3602
- if {$numcommits == 0} {
3603
- allcanvs delete all
3604
- }
3605
- set r0 $numcommits
3606
- set prev $numcommits
3607
- set numcommits $canshow
3608
- set t [clock clicks -milliseconds]
3609
- if {$prev < 100 || $viewcomplete($curview) || $t - $lastscrollset > 500} {
3610
- set lastscrollset $t
3608
+ global lastscrollset lastscrollrows commitinterest
3609
+
3610
+ if {$lastscrollrows < 100 || $viewcomplete($curview) ||
3611
+ [clock clicks -milliseconds] - $lastscrollset > 500} {
3612
setcanvscroll
3613
}
3613
- set rows [visiblerows]
3614
- set r1 [lindex $rows 1]
3615
- if {$r1 >= $canshow} {
3616
- set r1 [expr {$canshow - 1}]
3617
- }
3618
- if {$r0 <= $r1} {
3619
- drawcommits $r0 $r1
3620
- }
3614
if {[info exists pending_select] &&
3615
[commitinview $pending_select $curview]} {
3616
selectline [rowofcommit $pending_select] 1
3617
}
3618
+ drawvisible
3619
}
3620
3621
proc doshowlocalchanges {} {
4708
if {[info exists selectedline] &&
4709
$row <= $selectedline && $selectedline <= $endrow} {
4710
set targetrow $selectedline
4717
- } else {
4711
+ } elseif {[info exists targetid]} {
4712
set targetrow [expr {int(($row + $endrow) / 2)}]
4713
}
4720
- if {$targetrow >= $numcommits} {
4721
- set targetrow [expr {$numcommits - 1}]
4714
+ if {[info exists targetrow]} {
4715
+ if {$targetrow >= $numcommits} {
4716
+ set targetrow [expr {$numcommits - 1}]
4717
+ }
4718
+ set targetid [commitonrow $targetrow]
4719
}
4723
- set targetid [commitonrow $targetrow]
4720
drawcommits $row $endrow
4721
}
4722
5455
unsel_reflist
5456
stopfinding
5457
if {$l < 0 || $l >= $numcommits} return
5458
+ set id [commitonrow $l]
5459
+ set targetid $id
5460
+ set targetrow $l
5461
+
5462
set y [expr {$canvy0 + $l * $linespc}]
5463
set ymax [lindex [$canv cget -scrollregion] 3]
5464
set ytop [expr {$y - $linespc - 1}]
5497
5498
make_secsel $l
5499
5500
- set id [commitonrow $l]
5500
if {$isnew} {
5501
addtohistory [list selbyid $id]
5502
}
5503
5504
set selectedline $l
5505
set currentid $id
5507
- set targetid $id
5508
- set targetrow $l
5506
$sha1entry delete 0 end
5507
$sha1entry insert 0 $id
5508
$sha1entry selection from 0