Esc to close filter popup window
Summary: Esc to close filter popup window
use std::cell::RefCell;
use std::rc::Rc;
+use cursive::event::Key;
use cursive::view::{Identifiable, View};
-use cursive::views::{Dialog, EditView};
+use cursive::views::{Dialog, EditView, OnEventView};
use cursive::Cursive;
use crate::view::stats_view::StateCommon;
@@ -46,6 +47,7 @@ where
.unwrap_or(&"".to_string()),
);
+ OnEventView::new(
Dialog::new()
.title("Filter by name")
.padding_lrtb(1, 1, 1, 0)
@@ -66,5 +68,9 @@ where
// Pop dialog
c.pop_layer();
+ }),
+ )
+ .on_event(Key::Esc, |s| {
+ s.pop_layer();
})
}
