mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
editor: Delete unused isTimeUp
argument
This fixes a SonarCloud error.
This commit is contained in:
parent
ed7ba64635
commit
d24306ea6a
1 changed files with 12 additions and 30 deletions
|
@ -868,7 +868,7 @@ function Ace2Inner() {
|
||||||
|
|
||||||
function fastIncorp(n) {
|
function fastIncorp(n) {
|
||||||
// normalize but don't do any lexing or anything
|
// normalize but don't do any lexing or anything
|
||||||
incorporateUserChanges(newTimeLimit(0));
|
incorporateUserChanges();
|
||||||
}
|
}
|
||||||
editorInfo.ace_fastIncorp = fastIncorp;
|
editorInfo.ace_fastIncorp = fastIncorp;
|
||||||
|
|
||||||
|
@ -886,10 +886,7 @@ function Ace2Inner() {
|
||||||
let finishedWork = false;
|
let finishedWork = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// isTimeUp() is a soft constraint for incorporateUserChanges,
|
incorporateUserChanges();
|
||||||
// which always renormalizes the DOM, no matter how long it takes,
|
|
||||||
// but doesn't necessarily lex and highlight it
|
|
||||||
incorporateUserChanges(isTimeUp);
|
|
||||||
|
|
||||||
if (isTimeUp()) return;
|
if (isTimeUp()) return;
|
||||||
|
|
||||||
|
@ -928,7 +925,7 @@ function Ace2Inner() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function recolorLinesInRange(startChar, endChar, isTimeUp) {
|
function recolorLinesInRange(startChar, endChar) {
|
||||||
if (endChar <= startChar) return;
|
if (endChar <= startChar) return;
|
||||||
if (startChar < 0 || startChar >= rep.lines.totalWidth()) return;
|
if (startChar < 0 || startChar >= rep.lines.totalWidth()) return;
|
||||||
let lineEntry = rep.lines.atOffset(startChar); // rounds down to line boundary
|
let lineEntry = rep.lines.atOffset(startChar); // rounds down to line boundary
|
||||||
|
@ -937,7 +934,6 @@ function Ace2Inner() {
|
||||||
let selectionNeedsResetting = false;
|
let selectionNeedsResetting = false;
|
||||||
let firstLine = null;
|
let firstLine = null;
|
||||||
let lastLine = null;
|
let lastLine = null;
|
||||||
isTimeUp = (isTimeUp || noop);
|
|
||||||
|
|
||||||
// tokenFunc function; accesses current value of lineEntry and curDocChar,
|
// tokenFunc function; accesses current value of lineEntry and curDocChar,
|
||||||
// also mutates curDocChar
|
// also mutates curDocChar
|
||||||
|
@ -946,7 +942,7 @@ function Ace2Inner() {
|
||||||
lineEntry.domInfo.appendSpan(tokenText, tokenClass);
|
lineEntry.domInfo.appendSpan(tokenText, tokenClass);
|
||||||
};
|
};
|
||||||
|
|
||||||
while (lineEntry && lineStart < endChar && !isTimeUp()) {
|
while (lineEntry && lineStart < endChar) {
|
||||||
const lineEnd = lineStart + lineEntry.width;
|
const lineEnd = lineStart + lineEntry.width;
|
||||||
|
|
||||||
curDocChar = lineStart;
|
curDocChar = lineStart;
|
||||||
|
@ -1112,16 +1108,11 @@ function Ace2Inner() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function incorporateUserChanges(isTimeUp) {
|
function incorporateUserChanges() {
|
||||||
if (currentCallStack.domClean) return false;
|
if (currentCallStack.domClean) return false;
|
||||||
|
|
||||||
currentCallStack.isUserChange = true;
|
currentCallStack.isUserChange = true;
|
||||||
|
|
||||||
isTimeUp = (isTimeUp ||
|
|
||||||
function () {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (DEBUG && window.DONT_INCORP || window.DEBUG_DONT_INCORP) return false;
|
if (DEBUG && window.DONT_INCORP || window.DEBUG_DONT_INCORP) return false;
|
||||||
|
|
||||||
const p = PROFILER('incorp', false);
|
const p = PROFILER('incorp', false);
|
||||||
|
@ -1270,7 +1261,7 @@ function Ace2Inner() {
|
||||||
// do DOM inserts
|
// do DOM inserts
|
||||||
p.mark('insert');
|
p.mark('insert');
|
||||||
_.each(domInsertsNeeded, (ins) => {
|
_.each(domInsertsNeeded, (ins) => {
|
||||||
insertDomLines(ins[0], ins[1], isTimeUp);
|
insertDomLines(ins[0], ins[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
p.mark('del');
|
p.mark('del');
|
||||||
|
@ -1368,12 +1359,7 @@ function Ace2Inner() {
|
||||||
return AttributeManager.DEFAULT_LINE_ATTRIBUTES.indexOf(aname) !== -1;
|
return AttributeManager.DEFAULT_LINE_ATTRIBUTES.indexOf(aname) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertDomLines(nodeToAddAfter, infoStructs, isTimeUp) {
|
function insertDomLines(nodeToAddAfter, infoStructs) {
|
||||||
isTimeUp = (isTimeUp ||
|
|
||||||
function () {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
let lastEntry;
|
let lastEntry;
|
||||||
let lineStartOffset;
|
let lineStartOffset;
|
||||||
if (infoStructs.length < 1) return;
|
if (infoStructs.length < 1) return;
|
||||||
|
@ -1405,7 +1391,7 @@ function Ace2Inner() {
|
||||||
p2.mark('spans');
|
p2.mark('spans');
|
||||||
getSpansForLine(entry, (tokenText, tokenClass) => {
|
getSpansForLine(entry, (tokenText, tokenClass) => {
|
||||||
info.appendSpan(tokenText, tokenClass);
|
info.appendSpan(tokenText, tokenClass);
|
||||||
}, lineStartOffset, isTimeUp());
|
}, lineStartOffset);
|
||||||
p2.mark('addLine');
|
p2.mark('addLine');
|
||||||
info.prepareForAdd();
|
info.prepareForAdd();
|
||||||
entry.lineMarker = info.lineMarker;
|
entry.lineMarker = info.lineMarker;
|
||||||
|
@ -1603,7 +1589,7 @@ function Ace2Inner() {
|
||||||
const linesMutatee = {
|
const linesMutatee = {
|
||||||
splice(start, numRemoved, newLinesVA) {
|
splice(start, numRemoved, newLinesVA) {
|
||||||
const args = Array.prototype.slice.call(arguments, 2);
|
const args = Array.prototype.slice.call(arguments, 2);
|
||||||
domAndRepSplice(start, numRemoved, _.map(args, (s) => s.slice(0, -1)), null);
|
domAndRepSplice(start, numRemoved, _.map(args, (s) => s.slice(0, -1)));
|
||||||
},
|
},
|
||||||
get(i) {
|
get(i) {
|
||||||
return `${rep.lines.atIndex(i).text}\n`;
|
return `${rep.lines.atIndex(i).text}\n`;
|
||||||
|
@ -1622,11 +1608,7 @@ function Ace2Inner() {
|
||||||
performSelectionChange(lineAndColumnFromChar(requiredSelectionSetting[0]), lineAndColumnFromChar(requiredSelectionSetting[1]), requiredSelectionSetting[2]);
|
performSelectionChange(lineAndColumnFromChar(requiredSelectionSetting[0]), lineAndColumnFromChar(requiredSelectionSetting[1]), requiredSelectionSetting[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function domAndRepSplice(startLine, deleteCount, newLineStrings, isTimeUp) {
|
function domAndRepSplice(startLine, deleteCount, newLineStrings) {
|
||||||
// dgreensp 3/2009: the spliced lines may be in the middle of a dirty region,
|
|
||||||
// so if no explicit time limit, don't spend a lot of time highlighting
|
|
||||||
isTimeUp = (isTimeUp || newTimeLimit(50));
|
|
||||||
|
|
||||||
const keysToDelete = [];
|
const keysToDelete = [];
|
||||||
if (deleteCount > 0) {
|
if (deleteCount > 0) {
|
||||||
let entryToDelete = rep.lines.atIndex(startLine);
|
let entryToDelete = rep.lines.atIndex(startLine);
|
||||||
|
@ -1645,7 +1627,7 @@ function Ace2Inner() {
|
||||||
nodeToAddAfter = getCleanNodeByKey(rep.lines.atIndex(startLine - 1).key);
|
nodeToAddAfter = getCleanNodeByKey(rep.lines.atIndex(startLine - 1).key);
|
||||||
} else { nodeToAddAfter = null; }
|
} else { nodeToAddAfter = null; }
|
||||||
|
|
||||||
insertDomLines(nodeToAddAfter, _.map(lineEntries, (entry) => entry.domInfo), isTimeUp);
|
insertDomLines(nodeToAddAfter, _.map(lineEntries, (entry) => entry.domInfo));
|
||||||
|
|
||||||
_.each(keysToDelete, (k) => {
|
_.each(keysToDelete, (k) => {
|
||||||
const n = doc.getElementById(k);
|
const n = doc.getElementById(k);
|
||||||
|
@ -4366,7 +4348,7 @@ function Ace2Inner() {
|
||||||
while (root.firstChild) root.removeChild(root.firstChild);
|
while (root.firstChild) root.removeChild(root.firstChild);
|
||||||
const oneEntry = createDomLineEntry('');
|
const oneEntry = createDomLineEntry('');
|
||||||
doRepLineSplice(0, rep.lines.length(), [oneEntry]);
|
doRepLineSplice(0, rep.lines.length(), [oneEntry]);
|
||||||
insertDomLines(null, [oneEntry.domInfo], null);
|
insertDomLines(null, [oneEntry.domInfo]);
|
||||||
rep.alines = Changeset.splitAttributionLines(
|
rep.alines = Changeset.splitAttributionLines(
|
||||||
Changeset.makeAttribution('\n'), '\n');
|
Changeset.makeAttribution('\n'), '\n');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue