Changeset: Use `break` instead of `done` variable

pull/5268/head
Richard Hansen 2021-11-08 23:35:03 -05:00
parent 44d99733c6
commit ca5bdddc59
2 changed files with 6 additions and 10 deletions

View File

@ -285,15 +285,13 @@ PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) {
curLineOpIter = Changeset.opIterator(aLinesGet(curLine));
curLineOpIterLine = curLine;
let indexIntoLine = 0;
let done = false;
while (!done && curLineOpIter.hasNext()) {
while (curLineOpIter.hasNext()) {
curLineNextOp = curLineOpIter.next();
if (indexIntoLine + curLineNextOp.chars >= curChar) {
curLineNextOp.chars -= (curChar - indexIntoLine);
done = true;
} else {
indexIntoLine += curLineNextOp.chars;
break;
}
indexIntoLine += curLineNextOp.chars;
}
}

View File

@ -2052,15 +2052,13 @@ exports.inverse = (cs, lines, alines, pool) => {
curLineOpIter = exports.opIterator(alinesGet(curLine));
curLineOpIterLine = curLine;
let indexIntoLine = 0;
let done = false;
while (!done && curLineOpIter.hasNext()) {
while (curLineOpIter.hasNext()) {
curLineNextOp = curLineOpIter.next();
if (indexIntoLine + curLineNextOp.chars >= curChar) {
curLineNextOp.chars -= (curChar - indexIntoLine);
done = true;
} else {
indexIntoLine += curLineNextOp.chars;
break;
}
indexIntoLine += curLineNextOp.chars;
}
}