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

Prepopulate replace input with current editor selection #1964

Merged
merged 3 commits into from
Oct 29, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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