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), }