remove redundant setGutterMarker optimization

This commit is contained in:
tophf 2020-05-31 23:04:49 +03:00
parent a7a9ee7205
commit 5b42055839

View File

@ -242,23 +242,6 @@
CodeMirror.commands[name] = (...args) => editor[name](...args); CodeMirror.commands[name] = (...args) => editor[name](...args);
} }
// speedup: reuse the old folding marks
// TODO: remove when https://github.com/codemirror/CodeMirror/pull/6010 is shipped in /vendor
const {setGutterMarker} = CodeMirror.prototype;
CodeMirror.prototype.setGutterMarker = function (line, gutterID, value) {
const o = this.state.foldGutter.options;
if (typeof o.indicatorOpen === 'string' ||
typeof o.indicatorFolded === 'string') {
const old = line.gutterMarkers && line.gutterMarkers[gutterID];
// old className can contain other names set by CodeMirror so we'll use classList
if (old && value && old.classList.contains(value.className) ||
!old && !value) {
return line;
}
}
return setGutterMarker.apply(this, arguments);
};
// CodeMirror convenience commands // CodeMirror convenience commands
Object.assign(CodeMirror.commands, { Object.assign(CodeMirror.commands, {
toggleEditorFocus, toggleEditorFocus,