From de0c232b39c71d76b8e82872df4e1e5bccab5fd0 Mon Sep 17 00:00:00 2001 From: Rosemoe <2073412493@qq.com> Date: Fri, 27 Oct 2023 13:22:06 +0800 Subject: [PATCH] fix: unable to replace current selected searching text to empty string --- .../java/io/github/rosemoe/sora/widget/EditorSearcher.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/src/main/java/io/github/rosemoe/sora/widget/EditorSearcher.java b/editor/src/main/java/io/github/rosemoe/sora/widget/EditorSearcher.java index 03f7ca91b..da14803cf 100644 --- a/editor/src/main/java/io/github/rosemoe/sora/widget/EditorSearcher.java +++ b/editor/src/main/java/io/github/rosemoe/sora/widget/EditorSearcher.java @@ -282,7 +282,11 @@ public void replaceThis(@NonNull String replacement) { return; } if (isMatchedPositionSelected()) { - editor.commitText(replacement); + if (replacement.isEmpty()) { + editor.deleteText(); + } else { + editor.commitText(replacement); + } } else { gotoNext(); }