gitk: Fix bug introduced in commit 67a4f1a7
In fixing the "can't unset idinlist" error, I moved the setting of idinlist into the loop that splits the parents into "new" parents (i.e. those of which this is the first child) and "old" parents. Unfortunately this is incorrect in the case where we hit the break statement a few lines further down, since when we come back in, we'll see idinlist($p) set for some parents that aren't in the list. This fixes it by moving the loop that sets up newolds and oldolds further down. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Aug 13, 2007 at 14:52 UTC
7b459a1c1cc5401295e3adb12031e39e35712f4a
1 file changed
+14
-10
gitk
+14
-10
@@ -2895,18 +2895,12 @@ proc layoutrows {row endrow last} {
2895
set offs [lindex $rowoffsets $row]
2896
while {$row < $endrow} {
2897
set id [lindex $displayorder $row]
2898
- set oldolds {}
2899
- set newolds {}
2898
+ set nev [expr {[llength $idlist] - $maxwidth + 1}]
2899
foreach p [lindex $parentlist $row] {
2901
- if {![info exists idinlist($p)]} {
2902
- lappend newolds $p
2903
- } elseif {!$idinlist($p)} {
2904
- lappend oldolds $p
2900
+ if {![info exists idinlist($p)] || !$idinlist($p)} {
2901
+ incr nev
2902
}
2906
- set idinlist($p) 1
2903
}
2908
- set nev [expr {[llength $idlist] + [llength $newolds]
2909
- + [llength $oldolds] - $maxwidth + 1}]
2904
if {$nev > 0} {
2905
if {!$last &&
2906
$row + $uparrowlen + $mingaplen >= $commitidx($curview)} break
@@ -2925,12 +2919,22 @@ proc layoutrows {row endrow last} {
2919
if {[incr nev -1] <= 0} break
2920
continue
2921
}
2928
- set rowchk($id) [expr {$row + $r}]
2922
+ set rowchk($i) [expr {$row + $r}]
2923
}
2924
}
2925
lset rowidlist $row $idlist
2926
lset rowoffsets $row $offs
2927
}
2928
+ set oldolds {}
2929
+ set newolds {}
2930
+ foreach p [lindex $parentlist $row] {
2931
+ if {![info exists idinlist($p)]} {
2932
+ lappend newolds $p
2933
+ } elseif {!$idinlist($p)} {
2934
+ lappend oldolds $p
2935
+ }
2936
+ set idinlist($p) 1
2937
+ }
2938
set col [lsearch -exact $idlist $id]
2939
if {$col < 0} {
2940
set col [llength $idlist]