Skip to content

Commit 3fc4279

Browse files
committed
gitk: Add some more comments to the optimize_rows procedure
Signed-off-by: Paul Mackerras <[email protected]>
1 parent 0a4dd8b commit 3fc4279

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

gitk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,7 +2739,13 @@ proc optimize_rows {row col endrow} {
27392739
set isarrow 1
27402740
}
27412741
}
2742+
# Looking at lines from this row to the previous row,
2743+
# make them go straight up if they end in an arrow on
2744+
# the previous row; otherwise make them go straight up
2745+
# or at 45 degrees.
27422746
if {$z < -1 || ($z < 0 && $isarrow)} {
2747+
# Line currently goes left too much;
2748+
# insert pads in the previous row, then optimize it
27432749
set npad [expr {-1 - $z + $isarrow}]
27442750
set offs [incrange $offs $col $npad]
27452751
insert_pad $y0 $x0 $npad
@@ -2750,6 +2756,8 @@ proc optimize_rows {row col endrow} {
27502756
set x0 [expr {$col + $z}]
27512757
set z0 [lindex $rowoffsets $y0 $x0]
27522758
} elseif {$z > 1 || ($z > 0 && $isarrow)} {
2759+
# Line currently goes right too much;
2760+
# insert pads in this line and adjust the next's rowoffsets
27532761
set npad [expr {$z - 1 + $isarrow}]
27542762
set y1 [expr {$row + 1}]
27552763
set offs2 [lindex $rowoffsets $y1]
@@ -2780,6 +2788,7 @@ proc optimize_rows {row col endrow} {
27802788
set z0 [expr {$xc - $x0}]
27812789
}
27822790
}
2791+
# avoid lines jigging left then immediately right
27832792
if {$z0 ne {} && $z < 0 && $z0 > 0} {
27842793
insert_pad $y0 $x0 1
27852794
set offs [incrange $offs $col 1]
@@ -2788,6 +2797,7 @@ proc optimize_rows {row col endrow} {
27882797
}
27892798
if {!$haspad} {
27902799
set o {}
2800+
# Find the first column that doesn't have a line going right
27912801
for {set col [llength $idlist]} {[incr col -1] >= 0} {} {
27922802
set o [lindex $offs $col]
27932803
if {$o eq {}} {
@@ -2806,6 +2816,8 @@ proc optimize_rows {row col endrow} {
28062816
}
28072817
if {$o eq {} || $o <= 0} break
28082818
}
2819+
# Insert a pad at that column as long as it has a line and
2820+
# isn't the last column, and adjust the next row' offsets
28092821
if {$o ne {} && [incr col] < [llength $idlist]} {
28102822
set y1 [expr {$row + 1}]
28112823
set offs2 [lindex $rowoffsets $y1]

0 commit comments

Comments
 (0)