From b6e9a953fbe3dfb272a8ecdbbd462435e2f074a1 Mon Sep 17 00:00:00 2001 From: dzmipt Date: Sun, 20 Mar 2022 21:53:13 +0300 Subject: [PATCH 1/2] select search text to replace the whole text when a user starts typing (cherry picked from commit bd9f58e6a640f24a121c8c38e64f2237df9ce075) --- src/main/studio/ui/SearchPanel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/studio/ui/SearchPanel.java b/src/main/studio/ui/SearchPanel.java index c9f251d3..3b9cb378 100644 --- a/src/main/studio/ui/SearchPanel.java +++ b/src/main/studio/ui/SearchPanel.java @@ -112,6 +112,7 @@ public void setReplaceVisible(boolean visible) { public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { + txtFind.selectAll(); txtFind.requestFocus(); } } From 611f3fec5dc8efce56c61fca67ab795312609bbf Mon Sep 17 00:00:00 2001 From: dzmipt Date: Sun, 20 Mar 2022 22:01:08 +0300 Subject: [PATCH 2/2] fix Find Back action (cherry picked from commit fcf43c10b14ae6e1dd19f9e252cc517fa2c44309) --- src/main/studio/ui/SearchPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/studio/ui/SearchPanel.java b/src/main/studio/ui/SearchPanel.java index 3b9cb378..f89fc1cd 100644 --- a/src/main/studio/ui/SearchPanel.java +++ b/src/main/studio/ui/SearchPanel.java @@ -140,7 +140,7 @@ private void doSearch(SearchContext context, SearchAction action) { } } - int pos = textArea.getCaretPosition(); + int pos = context.getSearchForward() ? textArea.getSelectionEnd() : textArea.getSelectionStart(); textArea.setSelectionStart(pos); textArea.setSelectionEnd(pos); SearchResult result;