File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -979,11 +979,17 @@ class TextLinesMutator {
979979 this . _curSplice . push ( ...newLines ) ;
980980 this . _curLine += newLines . length ;
981981 }
982- } else {
982+ } else if ( ! this . hasMore ( ) ) {
983983 // There are no additional lines. Although the line is put into splice, curLine is not
984- // increased because there may be more chars in the line (newline is not reached).
984+ // increased because there may be more chars in the line (newline is not reached). We are
985+ // inserting at the end of lines. curCol is 0 as curLine is not in splice.
986+ this . _curSplice . push ( text ) ;
987+ this . _curCol += text . length ;
988+ } else {
989+ // insert text after curCol
985990 const sline = this . _putCurLineInSplice ( ) ;
986991 if ( ! this . _curSplice [ sline ] ) {
992+ // TODO should never happen now
987993 const err = new Error (
988994 'curSplice[sline] not populated, actual curSplice contents is ' +
989995 `${ JSON . stringify ( this . _curSplice ) } . Possibly related to ` +
You can’t perform that action at this time.
0 commit comments