From 39a4b6c6960b6554a70dd81d32a3f689bf44a408 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 5 Dec 2017 05:39:33 +0300 Subject: [PATCH] clear previous search highlight from scrollbar in all sections --- edit/codemirror-editing-hooks.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/edit/codemirror-editing-hooks.js b/edit/codemirror-editing-hooks.js index a47b2e12..f1ac6212 100644 --- a/edit/codemirror-editing-hooks.js +++ b/edit/codemirror-editing-hooks.js @@ -342,16 +342,16 @@ onDOMready().then(() => { customizeOpenDialog(activeCM, template.find, function (query) { this(query); searchState = activeCM.state.search; - if (editors.length === 1 || !searchState.query) { - return; - } + const searchOthers = editors.length > 1 && searchState.query; editors.forEach(cm => { if (cm !== activeCM) { cm.execCommand('clearSearch'); - updateState(cm, searchState); + if (searchOthers) { + updateState(cm, searchState); + } } }); - if (CodeMirror.cmpPos(searchState.posFrom, searchState.posTo) === 0) { + if (searchOthers && CodeMirror.cmpPos(searchState.posFrom, searchState.posTo) === 0) { findNext(activeCM); } });