fix(strider): clear search term on ESC (#2531)
This commit is contained in:
parent
09e8da6a3a
commit
b0a003dfc6
2 changed files with 10 additions and 4 deletions
|
|
@ -85,8 +85,11 @@ impl ZellijPlugin for State {
|
||||||
},
|
},
|
||||||
Event::Key(key) => match key {
|
Event::Key(key) => match key {
|
||||||
Key::Esc if self.typing_search_term() => {
|
Key::Esc if self.typing_search_term() => {
|
||||||
|
if self.search_state.search_term.is_empty() {
|
||||||
self.stop_typing_search_term();
|
self.stop_typing_search_term();
|
||||||
|
} else {
|
||||||
self.search_state.handle_key(key);
|
self.search_state.handle_key(key);
|
||||||
|
}
|
||||||
should_render = true;
|
should_render = true;
|
||||||
},
|
},
|
||||||
_ if self.typing_search_term() => {
|
_ if self.typing_search_term() => {
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,11 @@ impl SearchState {
|
||||||
},
|
},
|
||||||
Key::Ctrl('r') => self.toggle_search_filter(),
|
Key::Ctrl('r') => self.toggle_search_filter(),
|
||||||
Key::Esc => {
|
Key::Esc => {
|
||||||
hide_self();
|
if !self.search_term.is_empty() {
|
||||||
self.clear_state();
|
self.clear_state();
|
||||||
|
} else {
|
||||||
|
hide_self();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => self.append_to_search_term(key),
|
_ => self.append_to_search_term(key),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue