fix(strider): clear search term on ESC (#2531)

This commit is contained in:
Aram Drevekenin 2023-06-12 23:26:47 +02:00 committed by GitHub
parent 09e8da6a3a
commit b0a003dfc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -85,8 +85,11 @@ impl ZellijPlugin for State {
},
Event::Key(key) => match key {
Key::Esc if self.typing_search_term() => {
self.stop_typing_search_term();
self.search_state.handle_key(key);
if self.search_state.search_term.is_empty() {
self.stop_typing_search_term();
} else {
self.search_state.handle_key(key);
}
should_render = true;
},
_ if self.typing_search_term() => {

View File

@ -36,8 +36,11 @@ impl SearchState {
},
Key::Ctrl('r') => self.toggle_search_filter(),
Key::Esc => {
hide_self();
self.clear_state();
if !self.search_term.is_empty() {
self.clear_state();
} else {
hide_self();
}
},
_ => self.append_to_search_term(key),
}