Zeile 63 | Zeile 63 |
---|
function parseQuery(query) { var isRE = query.match(/^\/(.*)\/([a-z]*)$/); if (isRE) {
|
function parseQuery(query) { var isRE = query.match(/^\/(.*)\/([a-z]*)$/); if (isRE) {
|
query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); if (query.test("")) query = /x^/; } else if (query == "") { query = /x^/;
| try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); } catch(e) {} // Not a regular expression after all, do a string search
|
}
|
}
|
| if (typeof query == "string" ? query == "" : query.test("")) query = /x^/;
|
return query; } var queryDialog =
|
return query; } var queryDialog =
|
'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
| '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>';
|
function doSearch(cm, rev) { var state = getSearchState(cm); if (state.query) return findNext(cm, rev);
| function doSearch(cm, rev) { var state = getSearchState(cm); if (state.query) return findNext(cm, rev);
|
Zeile 82 | Zeile 82 |
---|
cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query)); state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query)); cm.addOverlay(state.overlay);
|
cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query)); state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query)); cm.addOverlay(state.overlay);
|
| if (cm.showMatchesOnScrollbar) { if (state.annotate) { state.annotate.clear(); state.annotate = null; } state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query)); }
|
state.posFrom = state.posTo = cm.getCursor(); findNext(cm, rev); });
| state.posFrom = state.posTo = cm.getCursor(); findNext(cm, rev); });
|
Zeile 103 | Zeile 107 |
---|
if (!state.query) return; state.query = null; cm.removeOverlay(state.overlay);
|
if (!state.query) return; state.query = null; cm.removeOverlay(state.overlay);
|
| if (state.annotate) { state.annotate.clear(); state.annotate = null; }
|
});}
var replaceQueryDialog =
|
});}
var replaceQueryDialog =
|
'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>'; var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>';
| 'Replace: <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>'; var replacementQueryDialog = 'With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
|
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>"; function replace(cm, all) {
|
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>"; function replace(cm, all) {
|
| if (cm.getOption("readOnly")) return;
|
dialog(cm, replaceQueryDialog, "Replace:", cm.getSelection(), function(query) { if (!query) return; query = parseQuery(query);
| dialog(cm, replaceQueryDialog, "Replace:", cm.getSelection(), function(query) { if (!query) return; query = parseQuery(query);
|