(cm, rev)
| 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); |
no test coverage detected