Merge pull request #386 from l-const/master
Consider clearing the search filtering when searchSubmit and the input is empty.
This commit is contained in:
commit
bd233d89ca
1 changed files with 12 additions and 1 deletions
13
src/app.rs
13
src/app.rs
|
|
@ -443,8 +443,14 @@ impl App {
|
||||||
if let Some(tab) = self.tab_model.data_mut::<Tab>(entity) {
|
if let Some(tab) = self.tab_model.data_mut::<Tab>(entity) {
|
||||||
match &tab.location {
|
match &tab.location {
|
||||||
Location::Path(path) | Location::Search(path, ..) => {
|
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(
|
tab.change_location(
|
||||||
&Location::Search(path.clone(), self.search_input.clone()),
|
&location,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
title_location_opt = Some((tab.title(), tab.location.clone()));
|
title_location_opt = Some((tab.title(), tab.location.clone()));
|
||||||
|
|
@ -1772,6 +1778,11 @@ impl Application for App {
|
||||||
Message::SearchSubmit => {
|
Message::SearchSubmit => {
|
||||||
if !self.search_input.is_empty() {
|
if !self.search_input.is_empty() {
|
||||||
return self.search();
|
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) => {
|
Message::SystemThemeModeChange(_theme_mode) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue