Remove num results when don't match find

This commit is contained in:
davidbmx 2019-09-10 12:38:12 -05:00
parent 22f958e50a
commit 6030b355ff

View file

@ -356,7 +356,10 @@ export default function(CodeMirror) {
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo); var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
if (!cursor.find(rev)) { if (!cursor.find(rev)) {
cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0)); cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
if (!cursor.find(rev)) return; if (!cursor.find(rev)) {
cm.display.wrapper.querySelector('.CodeMirror-search-results').innerText = '';
return;
}
} }
cm.setSelection(cursor.from(), cursor.to()); cm.setSelection(cursor.from(), cursor.to());
cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 60); cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 60);