Skip to content

Commit

Permalink
specify non-custom options explicitly
Browse files Browse the repository at this point in the history
fixes #1622
  • Loading branch information
tophf committed Jun 28, 2023
1 parent e4993f4 commit f2a656d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions edit/codemirror-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
const cms = new Set();
let lazyOpt;

const cmDefaults = CodeMirror.defaults;
const cmFactory = window.cmFactory = {

create(place, options) {
Expand All @@ -31,7 +32,7 @@
},

globalSetOption(key, value) {
CodeMirror.defaults[key] = value;
cmDefaults[key] = value;
if (cms.size > 4 && lazyOpt.names.includes(key)) {
lazyOpt.set(key, value);
} else {
Expand Down Expand Up @@ -71,7 +72,9 @@
k !== 'editor.arrowKeysTraverse' && // handled in sections-editor.js
prefToCmOpt(k) in CodeMirror.defaults);
const {insertTab, insertSoftTab} = CodeMirror.commands;

for (const key of prefKeys) {
cmDefaults[prefToCmOpt(key)] = prefs.get(key);
}
for (const [key, fn] of Object.entries({
'editor.tabSize'(cm, value) {
cm.setOption('indentUnit', Number(value));
Expand Down

0 comments on commit f2a656d

Please sign in to comment.