From 8e992299c660d7cf502c961eff8dad0dc237e7aa 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 8071d7d2..46550b8e 100644 --- a/edit/codemirror-editing-hooks.js +++ b/edit/codemirror-editing-hooks.js @@ -335,16 +335,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); } });