@@ -17,13 +17,12 @@ proc gitdir {} {
1717}
1818
1919proc start_rev_list {view} {
20- global startmsecs nextupdate ncmupdate
20+ global startmsecs nextupdate
2121 global commfd leftover tclencoding datemode
2222 global viewargs viewfiles commitidx
2323
2424 set startmsecs [clock clicks -milliseconds]
2525 set nextupdate [expr {$startmsecs + 100}]
26- set ncmupdate 1
2726 set commitidx($view ) 0
2827 set args $viewargs($view)
2928 if {$viewfiles($view) ne {}} {
@@ -79,7 +78,7 @@ proc getcommitlines {fd view} {
7978 global parentlist childlist children curview hlview
8079 global vparentlist vchildlist vdisporder vcmitlisted
8180
82- set stuff [read $fd ]
81+ set stuff [read $fd 500000 ]
8382 if {$stuff == {}} {
8483 if {![eof $fd ]} return
8584 global viewname
@@ -185,7 +184,7 @@ proc getcommitlines {fd view} {
185184 }
186185 if {$gotsome } {
187186 if {$view == $curview } {
188- layoutmore
187+ while {[ layoutmore $nextupdate ]} doupdate
189188 } elseif {[info exists hlview] && $view == $hlview } {
190189 vhighlightmore
191190 }
@@ -196,20 +195,13 @@ proc getcommitlines {fd view} {
196195}
197196
198197proc doupdate {} {
199- global commfd nextupdate numcommits ncmupdate
198+ global commfd nextupdate numcommits
200199
201200 foreach v [array names commfd] {
202201 fileevent $commfd($v) readable {}
203202 }
204203 update
205204 set nextupdate [expr {[clock clicks -milliseconds] + 100}]
206- if {$numcommits < 100} {
207- set ncmupdate [expr {$numcommits + 1}]
208- } elseif {$numcommits < 10000} {
209- set ncmupdate [expr {$numcommits + 10}]
210- } else {
211- set ncmupdate [expr {$numcommits + 100}]
212- }
213205 foreach v [array names commfd] {
214206 set fd $commfd($v)
215207 fileevent $fd readable [list getcommitlines $fd $v ]
@@ -1697,7 +1689,7 @@ proc showview {n} {
16971689 show_status " Reading commits..."
16981690 }
16991691 if {[info exists commfd($n )]} {
1700- layoutmore
1692+ layoutmore {}
17011693 } else {
17021694 finishcommits
17031695 }
@@ -2378,20 +2370,38 @@ proc visiblerows {} {
23782370 return [list $r0 $r1 ]
23792371}
23802372
2381- proc layoutmore {} {
2373+ proc layoutmore {tmax } {
23822374 global rowlaidout rowoptim commitidx numcommits optim_delay
23832375 global uparrowlen curview
23842376
2385- set row $rowlaidout
2386- set rowlaidout [layoutrows $row $commitidx($curview) 0]
2387- set orow [expr {$rowlaidout - $uparrowlen - 1}]
2388- if {$orow > $rowoptim } {
2389- optimize_rows $rowoptim 0 $orow
2390- set rowoptim $orow
2391- }
2392- set canshow [expr {$rowoptim - $optim_delay }]
2393- if {$canshow > $numcommits } {
2394- showstuff $canshow
2377+ while {1} {
2378+ if {$rowoptim - $optim_delay > $numcommits } {
2379+ showstuff [expr {$rowoptim - $optim_delay }]
2380+ } elseif {$rowlaidout - $uparrowlen - 1 > $rowoptim } {
2381+ set nr [expr {$rowlaidout - $uparrowlen - 1 - $rowoptim }]
2382+ if {$nr > 100} {
2383+ set nr 100
2384+ }
2385+ optimize_rows $rowoptim 0 [expr {$rowoptim + $nr }]
2386+ incr rowoptim $nr
2387+ } elseif {$commitidx($curview) > $rowlaidout } {
2388+ set nr [expr {$commitidx($curview) - $rowlaidout }]
2389+ # may need to increase this threshold if uparrowlen or
2390+ # mingaplen are increased...
2391+ if {$nr > 150} {
2392+ set nr 150
2393+ }
2394+ set row $rowlaidout
2395+ set rowlaidout [layoutrows $row [expr {$row + $nr }] 0]
2396+ if {$rowlaidout == $row } {
2397+ return 0
2398+ }
2399+ } else {
2400+ return 0
2401+ }
2402+ if {$tmax ne {} && [clock clicks -milliseconds] >= $tmax } {
2403+ return 1
2404+ }
23952405 }
23962406}
23972407
0 commit comments