MCPcopy
hub / github.com/philc/vimium / find

Method find

content_scripts/mode_visual.js:382–404  ·  view source on GitHub ↗
(count, backwards)

Source from the content-addressed store, hash-verified

380
381 // find: (count, backwards) =>
382 find(count, backwards) {
383 const initialRange = this.selection.getRangeAt(0).cloneRange();
384 for (let i = 0, end = count; i < end; i++) {
385 const nextQuery = FindMode.getQuery(backwards);
386 if (!nextQuery) {
387 HUD.show("No query to find.", 1000);
388 return;
389 }
390 if (!FindMode.execute(nextQuery, { colorSelection: false, backwards })) {
391 this.movement.setSelectionRange(initialRange);
392 HUD.show(`No matches for '${FindMode.query.rawQuery}'`, 1000);
393 return;
394 }
395 }
396
397 // The find was successfull. If we're in caret mode, then we should now have a selection, so we
398 // can drop back into visual mode.
399 if ((this.name === "caret") && (this.selection.toString().length > 0)) {
400 const mode = new VisualMode();
401 mode.init();
402 return mode;
403 }
404 }
405
406 // Yank the selection; always exits; collapses the selection; set @yankedText and return it.
407 yank(args) {

Callers 5

nextFrameFunction · 0.80
filterMethod · 0.80
syncEnabledKeysCaptionFunction · 0.80
"n"Function · 0.80
"N"Function · 0.80

Calls 5

initMethod · 0.95
getQueryMethod · 0.80
executeMethod · 0.80
setSelectionRangeMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected