diff --git a/src/editor.js b/src/editor.js index fbed78eb579..1dd855d97a0 100644 --- a/src/editor.js +++ b/src/editor.js @@ -2794,6 +2794,7 @@ config.defineOptions(Editor.prototype, "editor", { behavioursEnabled: {initialValue: true}, wrapBehavioursEnabled: {initialValue: true}, enableAutoIndent: {initialValue: true}, + enableDoubleFindToReplace: {initalValue: false}, autoScrollEditorIntoView: { set: function(val) {this.setAutoScrollEditorIntoView(val);} }, diff --git a/src/ext/searchbox.js b/src/ext/searchbox.js index 3b766dd68a4..d481c17fe2f 100644 --- a/src/ext/searchbox.js +++ b/src/ext/searchbox.js @@ -265,11 +265,9 @@ class SearchBox { var $searchBarKb = new HashHandler(); $searchBarKb.bindKeys({ "Ctrl-f|Command-f": function(sb) { - var isReplace = sb.isReplace = !sb.isReplace; - sb.replaceBox.style.display = isReplace ? "" : "none"; - sb.replaceOption.checked = false; + sb.replaceOption.checked = sb.editor.getOption('enableDoubleFindToReplace') && !sb.replaceOption.checked; sb.$syncOptions(); - sb.searchInput.focus(); + sb[sb.replaceOption.checked ? "replaceInput" : "searchInput"].focus(); }, "Ctrl-H|Command-Option-F": function(sb) { if (sb.editor.getReadOnly())