When holding down ALT+`x` for a long time it is randomly interpreted as ESC then `x`
Created by: ca1ek
When I press ALT+any character it will sometimes, randomly be read as pressing ESC then just that character. The issue is present both when using Gnome Terminal 3.22.2 and current Debian 9's Terminator. The problem isn't present for CTRL+x character combos.
extern crate termion;
use termion::event::Key;
use termion::event::Event;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
use std::io::{Write, stdout, stdin};
fn main() {
let stdin = stdin();
let mut stdout = stdout().into_raw_mode().unwrap();
write!(stdout,
"{}{}q to exit. Type stuff, use alt, and so on.{}",
termion::clear::All,
termion::cursor::Goto(1, 1),
termion::cursor::Hide)
.unwrap();
stdout.flush().unwrap();
for c in stdin.events() {
println!("{:?}\r", c);
match c.unwrap() {
Event::Key(Key::Char('q')) => break,
_ => {}
}
stdout.flush().unwrap();
}
write!(stdout, "{}", termion::cursor::Show).unwrap();
}
output:
Ok(Key(Alt('x')))
... 6 of these...
Ok(Key(Alt('x')))
Ok(Key(Esc))
Ok(Key(Char('x')))
Ok(Key(Esc))
Ok(Key(Char('x')))
... 14 of these ...
Ok(Key(Esc))
Ok(Key(Char('x')))
Ok(Key(Alt('x')))
... 7 of these ...
Ok(Key(Alt('x')))