vendor/assets/javascripts/codemirror/utils/search.js in codemirror-rails-2.36 vs vendor/assets/javascripts/codemirror/utils/search.js in codemirror-rails-3.00
- old
+ new
@@ -39,11 +39,12 @@
cm.operation(function() {
if (!query || state.query) return;
state.query = parseQuery(query);
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
for (var cursor = getSearchCursor(cm, state.query); cursor.findNext();)
- state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching"));
+ state.marked.push(cm.markText(cursor.from(), cursor.to(),
+ {className: "CodeMirror-searching"}));
}
state.posFrom = state.posTo = cm.getCursor();
findNext(cm, rev);
});
});
@@ -74,18 +75,18 @@
dialog(cm, replaceQueryDialog, "Replace:", function(query) {
if (!query) return;
query = parseQuery(query);
dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
if (all) {
- cm.compoundChange(function() { cm.operation(function() {
+ cm.operation(function() {
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
if (typeof query != "string") {
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
- cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];}));
+ cursor.replace(text.replace(/\$(\d)/, function(_, i) {return match[i];}));
} else cursor.replace(text);
}
- });});
+ });
} else {
clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor());
function advance() {
var start = cursor.from(), match;
@@ -98,10 +99,10 @@
confirmDialog(cm, doReplaceConfirm, "Replace?",
[function() {doReplace(match);}, advance]);
}
function doReplace(match) {
cursor.replace(typeof query == "string" ? text :
- text.replace(/\$(\d)/, function(w, i) {return match[i];}));
+ text.replace(/\$(\d)/, function(_, i) {return match[i];}));
advance();
}
advance();
}
});