@@ -127,6 +127,19 @@ var gitGraph = function (canvas, rawGraphList, config) {
127
127
return i ;
128
128
} ;
129
129
130
+ var findLineBreak = function ( row ) {
131
+ if ( ! row ) {
132
+ return - 1
133
+ }
134
+
135
+ var i = row . length ;
136
+
137
+ while ( i -- &&
138
+ ! ( row [ i - 1 ] && row [ i - 2 ] && row [ i ] === " " && row [ i - 1 ] === "|" && row [ i - 2 ] === "_" ) ) { }
139
+
140
+ return i ;
141
+ } ;
142
+
130
143
var genNewFlow = function ( ) {
131
144
var newId ;
132
145
@@ -173,7 +186,7 @@ var gitGraph = function (canvas, rawGraphList, config) {
173
186
} ;
174
187
175
188
var draw = function ( graphList ) {
176
- var colomn , colomnIndex , prevColomn , condenseIndex ;
189
+ var colomn , colomnIndex , prevColomn , condenseIndex , breakIndex = - 1 ;
177
190
var x , y ;
178
191
var color ;
179
192
var nodePos ;
@@ -265,13 +278,26 @@ var gitGraph = function (canvas, rawGraphList, config) {
265
278
colomnIndex = 0 ; //reset index
266
279
condenseIndex = 0 ;
267
280
condensePrevLength = 0 ;
281
+ breakIndex = - 1 ; //reset break index
268
282
while ( colomnIndex < currentRow . length ) {
269
283
colomn = currentRow [ colomnIndex ] ;
270
284
271
285
if ( colomn !== " " && colomn !== "_" ) {
272
286
++ condensePrevLength ;
273
287
}
274
288
289
+ //check and fix line break in next row
290
+ if ( colomn === "/" && currentRow [ colomnIndex - 1 ] && currentRow [ colomnIndex - 1 ] === "|" ) {
291
+ if ( ( breakIndex = findLineBreak ( nextRow ) ) !== - 1 ) {
292
+ nextRow . splice ( breakIndex , 1 ) ;
293
+ }
294
+ }
295
+ //if line break found replace all '/' with '|' after breakIndex in previous row
296
+ if ( breakIndex !== - 1 && colomn === "/" && colomnIndex > breakIndex ) {
297
+ currentRow [ colomnIndex ] = "|" ;
298
+ colomn = "|" ;
299
+ }
300
+
275
301
if ( colomn === " " &&
276
302
currentRow [ colomnIndex + 1 ] &&
277
303
currentRow [ colomnIndex + 1 ] === "_" &&
0 commit comments