diff --git a/edit/codemirror-factory.js b/edit/codemirror-factory.js index 68996bb9..801bee3a 100644 --- a/edit/codemirror-factory.js +++ b/edit/codemirror-factory.js @@ -42,6 +42,11 @@ const cmFactory = (() => { } else { cm.setOption('highlightSelectionMatches', null); } + if (value) { + cm.display.wrapper.dataset.matchHighlight = value; + } else { + delete cm.display.wrapper.dataset.matchHighlight; + } }); CodeMirror.defineOption('selectByTokens', prefs.get('editor.selectByTokens'), (cm, value) => { diff --git a/edit/edit.css b/edit/edit.css index 302df163..a0a49b86 100644 --- a/edit/edit.css +++ b/edit/edit.css @@ -364,7 +364,8 @@ input:invalid { .resize-grip-enabled .CodeMirror-scrollbar-filler { bottom: 7px; /* make space for resize-grip */ } -.cm-matchhighlight-approved .cm-matchhighlight, +[data-match-highlight=token].cm-matchhighlight-approved .cm-matchhighlight, +[data-match-highlight=selection] .cm-matchhighlight, .CodeMirror-selection-highlight-scrollbar { animation: fadein-match-highlighter 1s cubic-bezier(.97,.01,.42,.98); animation-fill-mode: both;