clone change positions to avoid breaking CodeMirror

This commit is contained in:
tophf 2020-12-10 23:25:07 +03:00
parent 579750fbc0
commit 775d77a3a8

View File

@ -107,11 +107,11 @@ function MozSectionFinder(cm) {
} }
} }
function update( function update(from = updFrom, to = updTo) {
from = updFrom || {line: 0, ch: 0},
to = updTo || {line: cm.doc.size, ch: 0}
) {
updFrom = updTo = null; updFrom = updTo = null;
// Cloning to avoid breaking the internals of CodeMirror
from = from ? {line: from.line, ch: from.ch} : {line: 0, ch: 0};
to = to ? {line: to.line, ch: to.ch} : {line: cm.doc.size, ch: 0};
const {sections, listeners} = getState(); const {sections, listeners} = getState();
let cutAt = -1; let cutAt = -1;
let cutTo = -1; let cutTo = -1;