From 09c0fe7b038c298bc02c1262af99962442d9fae6 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sun, 23 Jul 2023 18:08:37 +0100 Subject: [PATCH] Fix logic for clearing search entry --- src/Widgets/SearchBar.vala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Widgets/SearchBar.vala b/src/Widgets/SearchBar.vala index adb7f522c..e352dc552 100644 --- a/src/Widgets/SearchBar.vala +++ b/src/Widgets/SearchBar.vala @@ -253,8 +253,16 @@ namespace Scratch.Widgets { } private void on_selection_changed () { + var selected_text = text_view.get_selected_text (); - if (selected_text != search_entry.text) { + bool clear_required; + if (search_context.settings.case_sensitive) { + clear_required = selected_text != search_entry.text; + } else { + clear_required = selected_text.down () != search_entry.text.down (); + } + + if (clear_required) { search_entry.text = ""; } }