Skip to content

Commit bb99568

Browse files
committed
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 f4c6a9b commit bb99568

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
@@ -915,8 +915,9 @@ exports.textLinesMutator = (lines) => {
915915
curLine += newLines.length;
916916
// insert the remaining chars from the "old" line (e.g. the line we were in
917917
// when we started to insert new lines)
918-
curSplice.push(theLine.substring(lineCol));
919-
curCol = 0; // TODO(doc) why is this not set to the length of last line?
918+
const remaining = theLine.substring(lineCol);
919+
if (remaining !== '') curSplice.push(remaining);
920+
curCol = 0;
920921
} else {
921922
Array.prototype.push.apply(curSplice, newLines);
922923
curLine += newLines.length;

0 commit comments

Comments
 (0)