Clear search term when ESC is pressed

fixes #384
This commit is contained in:
Henrik Friedrichsen
2021-03-06 00:00:19 +01:00
parent d6db7a54d6
commit ff6788a2a9

View File

@@ -81,9 +81,11 @@ impl View for SearchView {
}
fn on_event(&mut self, event: Event) -> EventResult {
if event == Event::Key(Key::Esc) || event == Event::Key(Key::Tab) {
if event == Event::Key(Key::Tab) {
self.edit_focused = !self.edit_focused;
return EventResult::Consumed(None);
} else if self.edit_focused && event == Event::Key(Key::Esc) {
self.clear();
}
if self.edit_focused {