Closed filimonov closed 7 months ago
Esc is bad choice for binding to (see referenced commit), but support q/backspace for sidebar menu - make sense.
And what is the exact problem? Cursive should be able to distinguish Esc and Home (and similar)
use cursive::{Cursive, event::Key};
use cursive::views::{Dialog, OnEventView};
use cursive::CursiveExt;
fn main() {
let mut siv = Cursive::default();
let dialog = Dialog::text("Press Esc to quit, or Home for a surprise!")
.title("Key Event Example")
.button("OK", |s| s.add_layer(Dialog::info("You pressed OK!")));
let on_event_view = OnEventView::new(dialog)
.on_event(Key::Esc, |s| s.quit())
.on_event(Key::Home, |s| {
s.add_layer(Dialog::info("Surprise! You pressed Home."));
});
siv.add_layer(on_event_view);
siv.run();
}
And what is the exact problem? Cursive should be able to distinguish Esc and Home (and similar)
Either the problem is gone after switching backend or terminal, so OK now - https://github.com/azat/chdig/pull/54
Though to me q
looks better and more convenient, but OK to bind to both.
Since you use F1/F2/F8 keys you should also support Esc to close popups.