From 6f93e051829360d53ec8393d889962d0743db8bc Mon Sep 17 00:00:00 2001 From: l-const Date: Thu, 15 Aug 2024 16:30:52 +0300 Subject: [PATCH] Consider clearing the search filtering when searchSubmit and the input is empty. --- src/app.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 2e585c3..59109c8 100644 --- a/src/app.rs +++ b/src/app.rs @@ -443,8 +443,14 @@ impl App { if let Some(tab) = self.tab_model.data_mut::(entity) { match &tab.location { Location::Path(path) | Location::Search(path, ..) => { + let location = if !self.search_input.is_empty() { + Location::Search(path.clone(), self.search_input.clone()) + } + else { + Location::Path(path.clone()) + }; tab.change_location( - &Location::Search(path.clone(), self.search_input.clone()), + &location, None, ); title_location_opt = Some((tab.title(), tab.location.clone())); @@ -1772,6 +1778,11 @@ impl Application for App { Message::SearchSubmit => { if !self.search_input.is_empty() { return self.search(); + } else { + // rescan the tab to get the contents back + // and exit search + self.search_active = false; + return self.search(); } } Message::SystemThemeModeChange(_theme_mode) => {