Enable raw mode for ncurses

This commit is contained in:
Alexandre Bury 2019-02-28 16:20:07 -08:00
parent 0efba6bff6
commit 53ebf90c0c

View File

@ -92,7 +92,7 @@ impl Backend {
ncurses::noecho(); ncurses::noecho();
// This disables buffering and some input processing. // This disables buffering and some input processing.
// TODO: use ncurses::raw() ? // TODO: use ncurses::raw() ?
ncurses::cbreak(); ncurses::raw();
// This enables color support. // This enables color support.
ncurses::start_color(); ncurses::start_color();
// Pick up background and text color from the terminal theme. // Pick up background and text color from the terminal theme.
@ -482,6 +482,9 @@ fn initialize_keymap() -> HashMap<i32, Event> {
for c in 1..26 { for c in 1..26 {
let event = match c { let event = match c {
// This is Ctrl+C
// TODO: Don't exit here, but add this as a default callback
3 => Event::Exit,
9 => Event::Key(Key::Tab), 9 => Event::Key(Key::Tab),
10 => Event::Key(Key::Enter), 10 => Event::Key(Key::Enter),
other => Event::CtrlChar((b'a' - 1 + other as u8) as char), other => Event::CtrlChar((b'a' - 1 + other as u8) as char),