MCPcopy Create free account
hub / github.com/witheve/Eve / findNext

Function findNext

src/codemirror.js:13230–13250  ·  view source on GitHub ↗
(cm, prev, query, repeat)

Source from the content-addressed store, hash-verified

13228 }
13229 }
13230 function findNext(cm, prev, query, repeat) {
13231 if (repeat === undefined) { repeat = 1; }
13232 return cm.operation(function() {
13233 var pos = cm.getCursor();
13234 var cursor = cm.getSearchCursor(query, pos);
13235 for (var i = 0; i < repeat; i++) {
13236 var found = cursor.find(prev);
13237 if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); }
13238 if (!found) {
13239 // SearchCursor may have returned null because it hit EOF, wrap
13240 // around and try again.
13241 cursor = cm.getSearchCursor(query,
13242 (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) );
13243 if (!cursor.find(prev)) {
13244 return;
13245 }
13246 }
13247 }
13248 return cursor.from();
13249 });
13250 }
13251 function clearSearchHighlight(cm) {
13252 var state = getSearchState(cm);
13253 cm.removeOverlay(getSearchState(cm).getOverlay());

Callers 2

onPromptKeyUpFunction · 0.85
VimFunction · 0.85

Calls 7

cursorEqualFunction · 0.85
operationMethod · 0.80
getCursorMethod · 0.80
fromMethod · 0.80
lastLineMethod · 0.80
firstLineMethod · 0.80
findMethod · 0.65

Tested by

no test coverage detected