diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-06-12 23:26:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-12 23:26:47 +0200 |
commit | b0a003dfc6c0a8daad7af5666bb9ffef4b1b3e3d (patch) | |
tree | a6458023c827e794ddcaf55aa8032aa1139e324c /default-plugins | |
parent | 09e8da6a3a54699f040702567c5326d8ed22a068 (diff) |
fix(strider): clear search term on ESC (#2531)
Diffstat (limited to 'default-plugins')
-rw-r--r-- | default-plugins/strider/src/main.rs | 7 | ||||
-rw-r--r-- | default-plugins/strider/src/search/search_state.rs | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/default-plugins/strider/src/main.rs b/default-plugins/strider/src/main.rs index 966b53a4f..6cfaea81b 100644 --- a/default-plugins/strider/src/main.rs +++ b/default-plugins/strider/src/main.rs @@ -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() => { diff --git a/default-plugins/strider/src/search/search_state.rs b/default-plugins/strider/src/search/search_state.rs index 5766d1c29..c8707cc9d 100644 --- a/default-plugins/strider/src/search/search_state.rs +++ b/default-plugins/strider/src/search/search_state.rs @@ -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), } |