File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -835,20 +835,25 @@ exports.textLinesMutator = (lines) => {
835
835
} ;
836
836
if ( isCurLineInSplice ( ) ) {
837
837
if ( curCol === 0 ) {
838
+ // first line to be removed is in splice
838
839
removed = curSplice [ curSplice . length - 1 ] ;
839
840
curSplice . length -- ;
841
+ // next lines to be removed are not in splice
840
842
removed += nextKLinesText ( L - 1 ) ;
841
843
curSplice [ 1 ] += L - 1 ;
842
844
} else {
843
845
removed = nextKLinesText ( L - 1 ) ;
844
846
curSplice [ 1 ] += L - 1 ;
845
847
const sline = curSplice . length - 1 ;
846
848
removed = curSplice [ sline ] . substring ( curCol ) + removed ;
847
- curSplice [ sline ] = curSplice [ sline ] . substring ( 0 , curCol ) +
848
- linesGet ( curSplice [ 0 ] + curSplice [ 1 ] ) ;
849
- curSplice [ 1 ] += 1 ;
849
+ // is a line left?
850
+ const remaining = linesGet ( curSplice [ 0 ] + curSplice [ 1 ] ) || '' ;
851
+ curSplice [ sline ] = curSplice [ sline ] . substring ( 0 , curCol ) + remaining ;
852
+ curSplice [ 1 ] += remaining ? 1 : 0 ;
850
853
}
851
854
} else {
855
+ // nothing that is removed is in splice
856
+ // implies curCol === 0
852
857
removed = nextKLinesText ( L ) ;
853
858
curSplice [ 1 ] += L ;
854
859
}
You can’t perform that action at this time.
0 commit comments