-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Map more UTF-8 key events #3
Comments
As an update, we now have a |
Hey! I would love to contribute by adding support for modifier keys. so far, the Key variation is only a string type key =
| Up
| Down
| Left
| Right
| Space
| Escape
| Backspace
| Enter
| Key of string which means its not straight forward to just add a modifier to the key pressed without breaking the interface unless I add a new variation. But I think its a bad API to have both I thought about making it be type key_modifier =
| Ctrl
| Alt
| Shift
type key_event = {
key : string;
modifier : key_modifier;
} This would allow for telling which modifier was pressed with a key. But again, this would be a breaking change to the interface, which also requires to change all the examples. What do you think? |
As discussed in #45 we chose to use a pair of | KeyDown (Key "j" | Left, No_mofidier | Shift) -> ... |
At the moment we are only handling the space
" "
and keys in a nice way, but it'd be nice to be able to match onKeyDown Enter
orKeyDown "<enter>"
.Using a variant for all the keys may be a stretch, since we're parsing UTF-8 grapheme clusters, so at least some common ones we want to handle in a way that lets you match over KeyDown easily.
This is currently happening in the
minttea/io_loop.ml
in thetranslate
function:https://github.com/leostera/minttea/blob/main/minttea/io_loop.ml#L18
Currently implemented keys:
Missing keys:
The text was updated successfully, but these errors were encountered: