-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for using Ctrl/Alt/Meta with non-character keys #121
Conversation
I agree that ctrl-left/up/right/down, shift-left/up/right/down are missing. |
It's a good point. What do you think of something like this then? pub enum Key {
Backspace,
Char(char),
Delete,
Down,
End,
Enter,
Esc,
Home,
Insert,
Left,
Null,
PageDown,
PageUp,
Right,
Tab,
Unknown, // not sure about this, from UnknownEscSeq
Up,
}
pub struct KeyPress {
pub key: Key,
pub ctrl: bool,
pub alt: bool,
pub shift: bool,
pub meta: bool,
} |
|
In many other contexts the meta key is the same as the super key (aka windows, command, etc). https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey For clarity, I suppose it would be better to call it super here, instead of meta. |
1381f82
to
38b9fa1
Compare
So, I'm playing around with this a bit. I ended up implementing the above proposal and several macro helpers. What do you think? |
I don't know if the pending PRs will be integrated one day and, if they are, in which order. |
Indeed, although I suspect this PR will cause many conflicts with just about any other change. There is a lot being touched for this. |
Would you mind closing the PR ? |
Currently, key modifiers can only be used in conjunction with keys which map to a printable character. This pull request is a refactor that allows key modifiers to be used with any key, such as arrow keys, tab, etc.