@@ -108,26 +108,23 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
108108 unsolved . Insert ( 0 , headPath ) ;
109109 }
110110
111- // 2. Reserve leftmost column (offsetX) for HEAD path if not yet found
112- var offsetX = 4 - halfWidth ;
113- if ( alwaysShowCurrentHeadOnLeft && headPath == null && headPathSHAs . Count > 0 )
114- offsetX += unitWidth ;
115-
116- // 3. Keep track of max offsetX used in previous rows for margin calculation
111+ // 2. Keep track of max offsetX used in previous rows for margin calculation
117112 var maxOffsetOld = 0.0 ;
118113 foreach ( var l in unsolved )
119114 maxOffsetOld = Math . Max ( maxOffsetOld , l . LastX ) ;
120- if ( unsolved . Count == 0 )
121- maxOffsetOld = offsetX + unitWidth ;
122115
123- // 4. Process existing paths
116+ // 3. Process existing paths
117+ var offsetX = 4 - halfWidth ;
124118 foreach ( var l in unsolved )
125119 {
120+ offsetX += unitWidth ;
121+ if ( alwaysShowCurrentHeadOnLeft && headPathSHAs . Count > 0 && l != headPath && offsetX == 4 - halfWidth + unitWidth )
122+ offsetX += unitWidth ;
123+
126124 if ( l . Next . Equals ( commit . SHA , StringComparison . Ordinal ) )
127125 {
128126 if ( major == null )
129127 {
130- offsetX += unitWidth ;
131128 major = l ;
132129
133130 if ( commit . Parents . Count > 0 )
@@ -151,7 +148,6 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
151148 }
152149 else
153150 {
154- offsetX += unitWidth ;
155151 l . Pass ( offsetX , offsetY , halfHeight ) ;
156152 }
157153 }
@@ -164,7 +160,7 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
164160 }
165161 ended . Clear ( ) ;
166162
167- // 5 . Create new curve for branch tip or new merged commit
163+ // 4 . Create new curve for branch tip or new merged commit
168164 if ( major == null )
169165 {
170166 // If this is the start of the HEAD lineage, place it in the reserved column (index 0)
@@ -182,6 +178,9 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
182178 else if ( commit . Parents . Count > 0 )
183179 {
184180 offsetX += unitWidth ;
181+ if ( alwaysShowCurrentHeadOnLeft && headPathSHAs . Count > 0 && offsetX == 4 - halfWidth + unitWidth )
182+ offsetX += unitWidth ;
183+
185184 major = new PathHelper ( commit . Parents [ 0 ] , isMerged , colorPicker . Next ( ) , new Point ( offsetX , offsetY ) ) ;
186185 unsolved . Add ( major ) ;
187186 temp . Paths . Add ( major . Path ) ;
@@ -233,6 +232,8 @@ public static CommitGraph Parse(List<Commit> commits, bool firstParentOnlyEnable
233232 else
234233 {
235234 offsetX += unitWidth ;
235+ if ( alwaysShowCurrentHeadOnLeft && headPathSHAs . Count > 0 && offsetX == 4 - halfWidth + unitWidth )
236+ offsetX += unitWidth ;
236237
237238 // Create new curve for parent commit that not includes before
238239 var l = new PathHelper ( parentHash , isMerged , colorPicker . Next ( ) , position , new Point ( offsetX , position . Y + halfHeight ) ) ;
0 commit comments