Fix backspace detection

Backspace is code 127 (so right inside utf-8 territory) but we want to
treat is as special key, like codes < 32.
This commit is contained in:
Alexandre Bury 2015-05-27 22:24:19 -07:00
parent 0bdb86181b
commit 35c48e13d8

View File

@ -202,7 +202,7 @@ impl Cursive {
let ch = ncurses::getch(); let ch = ncurses::getch();
// Is it a UTF-8 starting point? // Is it a UTF-8 starting point?
if 32 <= ch && ch < 0x100 { if 32 <= ch && ch < 0x100 && ch != 127 {
Event::CharEvent(utf8::read_char(ch as u8, || ncurses::getch() as u8).unwrap()) Event::CharEvent(utf8::read_char(ch as u8, || ncurses::getch() as u8).unwrap())
} else { } else {
Event::KeyEvent(Key::from_ncurses(ch)) Event::KeyEvent(Key::from_ncurses(ch))