From 10c55a2328143f0a3f4da56662da8a40a82a2944 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 30 Nov 2021 00:27:38 -0500 Subject: [PATCH] Changeset: Explain why number of removals doesn't matter --- src/static/js/Changeset.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index 13bb47466..53b3f2c8f 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -808,11 +808,12 @@ class TextLinesMutator { * Indicates if curLine is already in the splice. This is necessary because the last element in * curSplice is curLine when this line is currently worked on (e.g. when skipping or inserting). * - * TODO(doc) why aren't removals considered? - * * @returns {boolean} true if curLine is in splice */ _isCurLineInSplice() { + // The value of `this._curSplice[1]` does not matter when determining the return value because + // `this._curLine` refers to the line number *after* the splice is applied (so after those lines + // are deleted). return this._curLine - this._curSplice[0] < this._curSplice.length - 2; }