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) => {
844844 } ;
845845 if ( isCurLineInSplice ( ) ) {
846846 if ( curCol === 0 ) {
847+ // first line to be removed is in splice
847848 removed = curSplice [ curSplice . length - 1 ] ;
848849 curSplice . length -- ;
850+ // next lines to be removed are not in splice
849851 removed += nextKLinesText ( L - 1 ) ;
850852 curSplice [ 1 ] += L - 1 ;
851853 } else {
852854 removed = nextKLinesText ( L - 1 ) ;
853855 curSplice [ 1 ] += L - 1 ;
854856 const sline = curSplice . length - 1 ;
855857 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 ;
859862 }
860863 } else {
864+ // nothing that is removed is in splice
865+ // implies curCol === 0
861866 removed = nextKLinesText ( L ) ;
862867 curSplice [ 1 ] += L ;
863868 }
You can’t perform that action at this time.
0 commit comments