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

Function doSearch

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

Source from the content-addressed store, hash-verified

73 var queryDialog =
74 'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>';
75 function doSearch(cm, rev) {
76 var state = getSearchState(cm);
77 if (state.query) return findNext(cm, rev);
78 dialog(cm, queryDialog, "Search for:", cm.getSelection(), function(query) {
79 cm.operation(function() {
80 if (!query || state.query) return;
81 state.query = parseQuery(query);
82 cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
83 state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
84 cm.addOverlay(state.overlay);
85 if (cm.showMatchesOnScrollbar) {
86 if (state.annotate) { state.annotate.clear(); state.annotate = null; }
87 state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));
88 }
89 state.posFrom = state.posTo = cm.getCursor();
90 findNext(cm, rev);
91 });
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);

Callers 1

search.jsFile · 0.85

Calls 6

getSearchStateFunction · 0.85
findNextFunction · 0.85
parseQueryFunction · 0.85
queryCaseInsensitiveFunction · 0.85
searchOverlayFunction · 0.85
dialogFunction · 0.70

Tested by

no test coverage detected