Fix: match-highlighter-helper only works in token mode

This commit is contained in:
eight 2018-11-08 01:49:04 +08:00
parent d4eee828a0
commit 8a10d5bef1
2 changed files with 7 additions and 1 deletions

View File

@ -42,6 +42,11 @@ const cmFactory = (() => {
} else { } else {
cm.setOption('highlightSelectionMatches', null); 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) => { CodeMirror.defineOption('selectByTokens', prefs.get('editor.selectByTokens'), (cm, value) => {

View File

@ -364,7 +364,8 @@ input:invalid {
.resize-grip-enabled .CodeMirror-scrollbar-filler { .resize-grip-enabled .CodeMirror-scrollbar-filler {
bottom: 7px; /* make space for resize-grip */ 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 { .CodeMirror-selection-highlight-scrollbar {
animation: fadein-match-highlighter 1s cubic-bezier(.97,.01,.42,.98); animation: fadein-match-highlighter 1s cubic-bezier(.97,.01,.42,.98);
animation-fill-mode: both; animation-fill-mode: both;