gitk: Fix some bugs in the new cherry-picking code
When inserting the new commit row for the cherry-picked commit, we weren't advancing the selected line (if there is one), and we weren't updating commitlisted properly.
Paul Mackerras committed
Aug 28, 2006 at 22:41 UTC
561d038ab8adb2bab5ba368b88e620be18c4811b
1 file changed
+6
-2
gitk
+6
-2
@@ -3314,14 +3314,14 @@ proc finishcommits {} {
3314
catch {unset pending_select}
3315
}
3316
3317
-# Inserting a new commit as the child of the commit on row $row.
3317
+# Insert a new commit as the child of the commit on row $row.
3318
# The new commit will be displayed on row $row and the commits
3319
# on that row and below will move down one row.
3320
proc insertrow {row newcmit} {
3321
global displayorder parentlist childlist commitlisted
3322
global commitrow curview rowidlist rowoffsets numcommits
3323
global rowrangelist idrowranges rowlaidout rowoptim numcommits
3324
- global linesegends
3324
+ global linesegends selectedline
3325
3326
if {$row >= $numcommits} {
3327
puts "oops, inserting new row $row but only have $numcommits rows"
@@ -3334,6 +3334,7 @@ proc insertrow {row newcmit} {
3334
lappend kids $newcmit
3335
lset childlist $row $kids
3336
set childlist [linsert $childlist $row {}]
3337
+ set commitlisted [linsert $commitlisted $row 1]
3338
set l [llength $displayorder]
3339
for {set r $row} {$r < $l} {incr r} {
3340
set id [lindex $displayorder $r]
@@ -3409,6 +3410,9 @@ proc insertrow {row newcmit} {
3410
incr rowoptim
3411
incr numcommits
3412
3413
+ if {[info exists selectedline] && $selectedline >= $row} {
3414
+ incr selectedline
3415
+ }
3416
redisplay
3417
}
3418