Curious event behavior
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 270
- Avg merge
- 5d 19h
- Merged PRs (30d)
- 2
Description
I'm fiddling with odd keyboard input combinations, and some of the weird key combinations aren't getting interpreted correctly. I'll break this down by backend (except for BearLibTerminal which I haven't got installed yet).
# ncurses and pancurses
* Modifier + direction keys gives a series of separate events, each of them corresponding to a single character for ANSI escape sequence. E.G. shift + left will raise six events:
* `Key(Esc)`
* `'['`
* `'1'`
* `';'`
* `'2'`
* `'C'`
* Ctrl + Numpad4 causes a SIGQUIT. I've tried it on two machines, stable vs. nightly, and with `TERM=xterm-256color` and `screen-256color` - it happened each time. I'm going to guess that, with numlock on, *for some reason*, `Ctrl-Numpad4` is getting interpreted as `Ctrl-\`, which (in case you didn't know) sends SIGQUIT to the foreground program (at least in Linux, not sure about the other Unices). Beyond that, Ctrl + Numpad in any other direction has some funky output:
|Ctrl + Numpad N|Event|
|-|-|
|1|`Char('1')`|
|2|`Unknown([0, 0, 0, 0])`|
|3|`Key(Esc)`|
|4|SIGQUIT|
|5|`Unknown([29, 0, 0, 0])`|
|6|`Unknown([30, 0, 0, 0])`|
|7|`Unknown([31, 0, 0, 0])`|
|8|`Key(Backspace)`|
|9|`Char('9')`|
# termion
* Ctrl + numpad works as expected (i.e. `CtrlKey('1')`, etc), **except** for:
|Ctrl + Numpad N|Event|
|-|-|
|2|`Unknown([])`|
|3|`Key(Esc)` (note that this matches ncurses behavior)|
|8|`Key(Backspace)` (note that this matches ncurses behavior)|
* Modifier + direction keys gives a single `Event::Unknown` with a vector of length 6 - presumably the ANSI escape sequence. e.g. shift + left yields `Event::Unknown([27, 91, 49, 59, 50, 68])`.
* Not key-input related, but trying to select something via the mouse with the termion backend triggers some kind of redraw that makes it impossible to select anything (since termion rendering is so slow).
I'm doing some weird stuff, I know. There will probably be more to come.
Contributor guide
Assessment
This issue has not been assessed yet.