Capture key modifiers
Opened this issue · 5 comments
Say I want to capture Shift / Alt / Ctrl
Is there any way of doing that with this library?
Is there any way of knowing if a key is currently pressed?
it seems like the lib only captures keydown
event and not keyup
so we can't even know if it was released or not?
from what i saw in the docs https://docs.rs/console/0.15.0/console/enum.Key.html there is no way to capture CTRL, but Shift and Alt can be captured.
im disappointed too, i just want capture CTRL, or Ctrl(char)
@alexzanderr
you can actually capture from ctrl keys with the use of ascii codes:
https://www.physics.udel.edu/~watson/scen103/ascii.html
Key::Char('\u{18}') == ctrl-x
however, this wont work for ctrl-c.
What if I need capturing Ctrl+C to gracefully handle interruption: could be some "raw mode" be introduced in the Term configuration to not fire the SIGINT? Any limitations?
Just tried to capture SHIFT (console-0.15.8 on macOS, iTerm) which does not seem to work. Looking at the code i cannot find any implementation for SHIFT in unix_term.rs
. Is this a bug?