MCPcopy Create free account
hub / github.com/TruthHun/BookStack / findNext

Function findNext

static/editor.md/lib/codemirror/addon/search/search.js:94–104  ·  view source on GitHub ↗
(cm, rev)

Source from the content-addressed store, hash-verified

92 });
93 }
94 function findNext(cm, rev) {cm.operation(function() {
95 var state = getSearchState(cm);
96 var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
97 if (!cursor.find(rev)) {
98 cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
99 if (!cursor.find(rev)) return;
100 }
101 cm.setSelection(cursor.from(), cursor.to());
102 cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
103 state.posFrom = cursor.from(); state.posTo = cursor.to();
104 });}
105 function clearSearch(cm) {cm.operation(function() {
106 var state = getSearchState(cm);
107 if (!state.query) return;

Callers 1

doSearchFunction · 0.85

Calls 2

getSearchStateFunction · 0.85
getSearchCursorFunction · 0.85

Tested by

no test coverage detected