From 52565e5ea1eb3b00023e15096d2b2e2a77b70fe2 Mon Sep 17 00:00:00 2001 From: nyx Date: Thu, 31 Oct 2024 14:41:03 -0400 Subject: [PATCH] clear the search bar if the user changes categories (#752) Co-authored-by: nyx --- tui/src/filter.rs | 4 ++++ tui/src/state.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/tui/src/filter.rs b/tui/src/filter.rs index 984d5d68..20192b03 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -164,4 +164,8 @@ impl Filter { self.search_input.remove(current); } } + pub fn clear_search(&mut self) { + self.search_input.clear(); + self.input_position = 0; + } } diff --git a/tui/src/state.rs b/tui/src/state.rs index d0c548bf..0f0b6fe5 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -783,6 +783,7 @@ impl AppState { 0usize, )]; self.selection.select(Some(0)); + self.filter.clear_search(); self.update_items(); }