Skip to content

Commit c579c86

Browse files
webzwo0irhansen
authored andcommitted
textLinesMutator: fix insertions with newlines at the end of a line. In
such cases the remaining part of the old line is directly pushed to the splice and we need to ensure it is not an empty string.
1 parent af7b5d1 commit c579c86

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/static/js/Changeset.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,9 @@ exports.textLinesMutator = (lines) => {
924924
curLine += newLines.length;
925925
// insert the remaining chars from the "old" line (e.g. the line we were in
926926
// when we started to insert new lines)
927-
curSplice.push(theLine.substring(lineCol));
928-
curCol = 0; // TODO(doc) why is this not set to the length of last line?
927+
const remaining = theLine.substring(lineCol);
928+
if (remaining !== '') curSplice.push(remaining);
929+
curCol = 0;
929930
} else {
930931
Array.prototype.push.apply(curSplice, newLines);
931932
curLine += newLines.length;

0 commit comments

Comments
 (0)