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