Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1964 from jbalsas/jbalsas/findreplace-selection
Browse files Browse the repository at this point in the history
Prepopulate Replace input with current editor selection (similar to Find)
  • Loading branch information
peterflynn committed Oct 29, 2012
2 parents 779e86f + 8b0112c commit 80d4ac1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/search/FindReplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ define(function (require, exports, module) {
});
} else {
clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor());
var cursor = getSearchCursor(cm, query, cm.getCursor(true));
var advance = function () {
var start = cursor.from(),
match = cursor.findNext();
Expand All @@ -247,6 +247,11 @@ define(function (require, exports, module) {
}
});
});

// Prepopulate the replace field with the current selection, if any
getDialogTextField()
.attr("value", cm.getSelection())
.get(0).select();
}

function _launchFind() {
Expand Down

0 comments on commit 80d4ac1

Please sign in to comment.