summaryrefslogtreecommitdiff
path: root/desktop/treeview.c
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/treeview.c')
-rw-r--r--desktop/treeview.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 48a031612..1d632bb63 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -915,6 +915,12 @@ static void treeview__search_cancel(treeview *tree, bool drop_focus)
return;
}
+ if (textarea_get_text(tree->search.textarea, NULL, 0) == 1) {
+ // If there's no text in the search box, we drop focus on a
+ // cancel. Note '1' because it includes the trailing \0
+ drop_focus = true;
+ }
+
if (drop_focus) {
tree->search.active = false;
textarea_set_caret(tree->search.textarea, -1);