diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index cf2b565adee..7419d37519d 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -924,8 +924,9 @@ exports.textLinesMutator = (lines) => { curLine += newLines.length; // insert the remaining chars from the "old" line (e.g. the line we were in // when we started to insert new lines) - curSplice.push(theLine.substring(lineCol)); - curCol = 0; // TODO(doc) why is this not set to the length of last line? + const remaining = theLine.substring(lineCol); + if (remaining !== '') curSplice.push(remaining); + curCol = 0; } else { Array.prototype.push.apply(curSplice, newLines); curLine += newLines.length;