From 06a294f5f61d5e3344c28452b2d6f085208086e3 Mon Sep 17 00:00:00 2001 From: Nunzio Tocci Date: Sat, 7 Oct 2023 13:47:17 -0500 Subject: [PATCH] add enableDoubleFindToReplace option --- src/editor.js | 1 + src/ext/searchbox.js | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) 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())