global curview viewdata viewfiles
global displayorder parentlist rowidlist
global colormap rowtextx commitrow nextcolor canvxmax
- global numcommits commitlisted rowchk
+ global numcommits commitlisted
global selectedline currentid canv canvy0
global treediffs
global pending_select phase
set rowlaidout [lindex $v 2]
set rowoptim [lindex $v 3]
set numcommits [lindex $v 4]
- catch {unset rowchk}
}
catch {unset colormap}
proc initlayout {} {
global rowidlist displayorder commitlisted
global rowlaidout rowoptim
- global rowchk
global numcommits canvxmax canv
global nextcolor
global parentlist
set parentlist {}
set nextcolor 0
set rowidlist {{}}
- catch {unset rowchk}
set rowlaidout 0
set rowoptim 0
set canvxmax [$canv cget -width]
return 0
}
+proc nextuse {id row} {
+ global commitrow curview children
+
+ if {[info exists children($curview,$id)]} {
+ foreach kid $children($curview,$id) {
+ if {[info exists commitrow($curview,$kid)] &&
+ $commitrow($curview,$kid) > $row} {
+ return $commitrow($curview,$kid)
+ }
+ }
+ }
+ if {[info exists commitrow($curview,$id)]} {
+ return $commitrow($curview,$id)
+ }
+ return -1
+}
+
proc layoutrows {row endrow last} {
global rowidlist displayorder
global uparrowlen downarrowlen maxwidth mingaplen
global children parentlist
global commitidx curview
- global rowchk
set idlist [lindex $rowidlist $row]
+ if {!$last && $endrow + $uparrowlen + $mingaplen > $commitidx($curview)} {
+ set endrow [expr {$commitidx($curview) - $uparrowlen - $mingaplen}]
+ }
while {$row < $endrow} {
set id [lindex $displayorder $row]
- if {1} {
- if {!$last &&
- $row + $uparrowlen + $mingaplen >= $commitidx($curview)} break
- for {set x [llength $idlist]} {[incr x -1] >= 0} {} {
- set i [lindex $idlist $x]
- if {![info exists rowchk($i)] || $row >= $rowchk($i)} {
- set r [usedinrange $i [expr {$row - $downarrowlen}] \
- [expr {$row + $uparrowlen + $mingaplen}]]
- if {$r == 0} {
- set idlist [lreplace $idlist $x $x]
- continue
- }
- set rowchk($i) [expr {$row + $r}]
+ if {$row > $downarrowlen} {
+ set termrow [expr {$row - $downarrowlen - 1}]
+ foreach p [lindex $parentlist $termrow] {
+ set i [lsearch -exact $idlist $p]
+ if {$i < 0} continue
+ set nr [nextuse $p $termrow]
+ if {$nr < 0 || $nr >= $row + $mingaplen + $uparrowlen} {
+ set idlist [lreplace $idlist $i $i]
}
}
lset rowidlist $row $idlist
global displayorder parentlist commitlisted children
global commitrow curview rowidlist numcommits
global rowlaidout rowoptim numcommits
- global selectedline rowchk commitidx
+ global selectedline commitidx
if {$row >= $numcommits} {
puts "oops, inserting new row $row but only have $numcommits rows"
}
set rowidlist [linsert $rowidlist $row $idlist]
- catch {unset rowchk}
-
incr rowlaidout
incr rowoptim
incr numcommits
global displayorder parentlist commitlisted children
global commitrow curview rowidlist numcommits
global rowlaidout rowoptim numcommits
- global linesegends selectedline rowchk commitidx
+ global linesegends selectedline commitidx
if {$row >= $numcommits} {
puts "oops, removing row $row but only have $numcommits rows"
set rowidlist [lreplace $rowidlist $row $row]
- catch {unset rowchk}
-
incr rowlaidout -1
incr rowoptim -1
incr numcommits -1