From 8a10d5bef1e054990d221d5845af4b0d8876c282 Mon Sep 17 00:00:00 2001 From: eight Date: Thu, 8 Nov 2018 01:49:04 +0800 Subject: [PATCH] Fix: match-highlighter-helper only works in token mode --- edit/codemirror-factory.js | 5 +++++ edit/edit.css | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) 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;