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 @@ -835,20 +835,25 @@ exports.textLinesMutator = (lines) => {
835835 } ;
836836 if ( isCurLineInSplice ( ) ) {
837837 if ( curCol === 0 ) {
838+ // first line to be removed is in splice
838839 removed = curSplice [ curSplice . length - 1 ] ;
839840 curSplice . length -- ;
841+ // next lines to be removed are not in splice
840842 removed += nextKLinesText ( L - 1 ) ;
841843 curSplice [ 1 ] += L - 1 ;
842844 } else {
843845 removed = nextKLinesText ( L - 1 ) ;
844846 curSplice [ 1 ] += L - 1 ;
845847 const sline = curSplice . length - 1 ;
846848 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 ;
850853 }
851854 } else {
855+ // nothing that is removed is in splice
856+ // implies curCol === 0
852857 removed = nextKLinesText ( L ) ;
853858 curSplice [ 1 ] += L ;
854859 }
You can’t perform that action at this time.
0 commit comments