Enable raw mode for pancurses

This commit is contained in:
Alexandre Bury 2019-02-28 16:22:48 -08:00
parent 53ebf90c0c
commit b83ab6f2d3

View File

@ -41,7 +41,7 @@ impl Backend {
window.keypad(true); window.keypad(true);
window.timeout(0); window.timeout(0);
pancurses::noecho(); pancurses::noecho();
pancurses::cbreak(); pancurses::raw();
pancurses::start_color(); pancurses::start_color();
pancurses::use_default_colors(); pancurses::use_default_colors();
pancurses::curs_set(0); pancurses::curs_set(0);
@ -128,6 +128,9 @@ impl Backend {
} }
pancurses::Input::Character('\u{9}') => Event::Key(Key::Tab), pancurses::Input::Character('\u{9}') => Event::Key(Key::Tab),
pancurses::Input::Character('\u{1b}') => Event::Key(Key::Esc), pancurses::Input::Character('\u{1b}') => Event::Key(Key::Esc),
// Ctrl+C
// TODO: Do not sent Exit here, but register it as a default callback
pancurses::Input::Character('\u{3}') => Event::Exit,
pancurses::Input::Character(c) if (c as u32) <= 26 => { pancurses::Input::Character(c) if (c as u32) <= 26 => {
Event::CtrlChar((b'a' - 1 + c as u8) as char) Event::CtrlChar((b'a' - 1 + c as u8) as char)
} }