@matheusbsbs / matheus-bagliano / commits / f56782aef4
Fork 0

gitk: Fix bugs in setting rowfinal

We weren't updating the rowfinal list in insertrow and removerow, so it was getting out of sync with rowidlist, which resulted in Tcl errors. This also optimizes the setting of rowfinal in layoutrows a bit. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Sep 15, 2007 at 09:04 UTC f56782aef4b3d7339461d8f12ff15f6258d9871d
1 file changed +9 -6
gitk
+9 -6
@@ -3008,20 +3008,21 @@ proc layoutrows {row endrow} {
3008
3009 set idlist {}
3010 if {$row > 0} {
3011 - foreach id [lindex $rowidlist [expr {$row - 1}]] {
3011 + set rm1 [expr {$row - 1}]
3012 + foreach id [lindex $rowidlist $rm1] {
3013 if {$id ne {}} {
3014 lappend idlist $id
3015 }
3016 }
3017 + set final [lindex $rowfinal $rm1]
3018 }
3019 for {} {$row < $endrow} {incr row} {
3020 set rm1 [expr {$row - 1}]
3019 - if {$rm1 < 0 || [lindex $rowidlist $rm1] eq {}} {
3021 + if {$rm1 < 0 || $idlist eq {}} {
3022 set idlist [make_idlist $row]
3023 set final 1
3024 } else {
3025 set id [lindex $displayorder $rm1]
3024 - set final [lindex $rowfinal $rm1]
3026 set col [lsearch -exact $idlist $id]
3027 set idlist [lreplace $idlist $col $col]
3028 foreach p [lindex $parentlist $rm1] {
@@ -3090,9 +3091,9 @@ proc layoutrows {row endrow} {
3091 } elseif {$row < $l} {
3092 if {![rowsequal $idlist [lindex $rowidlist $row]]} {
3093 lset rowidlist $row $idlist
3093 - lset rowfinal $row $final
3094 changedrow $row
3095 }
3096 + lset rowfinal $row $final
3097 } else {
3098 set pad [ntimes [expr {$row - $l}] {}]
3099 set rowidlist [concat $rowidlist $pad]
@@ -4055,7 +4056,7 @@ proc show_status {msg} {
4056 # on that row and below will move down one row.
4057 proc insertrow {row newcmit} {
4058 global displayorder parentlist commitlisted children
4058 - global commitrow curview rowidlist rowisopt numcommits
4059 + global commitrow curview rowidlist rowisopt rowfinal numcommits
4060 global numcommits
4061 global selectedline commitidx ordertok
4062
@@ -4089,6 +4090,7 @@ proc insertrow {row newcmit} {
4090 }
4091 set rowidlist [linsert $rowidlist $row $idlist]
4092 set rowisopt [linsert $rowisopt $row 0]
4093 + set rowfinal [linsert $rowfinal $row [lindex $rowfinal $row]]
4094
4095 incr numcommits
4096
@@ -4101,7 +4103,7 @@ proc insertrow {row newcmit} {
4103 # Remove a commit that was inserted with insertrow on row $row.
4104 proc removerow {row} {
4105 global displayorder parentlist commitlisted children
4104 - global commitrow curview rowidlist rowisopt numcommits
4106 + global commitrow curview rowidlist rowisopt rowfinal numcommits
4107 global numcommits
4108 global linesegends selectedline commitidx
4109
@@ -4130,6 +4132,7 @@ proc removerow {row} {
4132
4133 set rowidlist [lreplace $rowidlist $row $row]
4134 set rowisopt [lreplace $rowisopt $row $row]
4135 + set rowfinal [lreplace $rowfinal $row $row]
4136
4137 incr numcommits -1
4138