From 5386cb7f84b613b486cfbb54d39d50f30e78dc67 Mon Sep 17 00:00:00 2001 From: nyx Date: Thu, 3 Oct 2024 22:59:35 -0400 Subject: [PATCH] clear the search bar if the user changes categories --- 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 e6ff2cc2..2954a76a 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -158,4 +158,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 ce724868..455e8dbb 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -723,6 +723,7 @@ impl AppState { .root() .id()]; self.selection.select(Some(0)); + self.filter.clear_search(); self.update_items(); }