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
keyboard protocol: clarification on locked modifiers #7183
Comments
IIRC, kitty does not currently follow the spec exactly in that lock keys are only reported when some other modifier is present as well. I think this was done to make it easier for programs that kind of support CSIu to not get confused by the lock keys. |
Or maybe I am misremembering, need to check when am at my dev machine. |
Checking, I see caps_lock+space reported as expected when the caps_lock is engaged and the space key is pressed. |
Thanks for the quick fix/update! I'll update foot accordingly. |
Just to clarify this: The intent is that with even Do I have that correct? |
No, that's precisely the use case I was thinking of when I said kitty doesn't follow the spec precisely. The lock modifiers are not reported for keys that dont already have a CSIu encoding. This is to make this mode useable in programs that still want to mostly use legacy key handling. So having caps lock engaged and pressing a will just send A. But, having caps lock engaged and pressing an function key does report the modifier since the function key is already encoded as an escape code not as a text. So while technically this kind of violates the promise of this mode to disambiguate all keys (shift+A and caps_lock A are the same), its worth it for backwards compat. Easy to check with printf "\e[>1u"; showkey -a |
The keyboard speification doesn't really go into detail on how locked modifiers (e.g. CapsLock and NumLock) should be handled.
Regarding modifers, it does say that "The modifiers optional parameter encodes any modifiers pressed for the key event". "Pressed", not "effective", or "enabled".
Going on that alone, I would surmise that we should only report e.g. Caps and Num-lock in the key event, if those keys are actually pressed.
That is however not what I'm seeing in Kitty (on Linux, Wayland). There, at least NumLock is included in the modifier list of the key event whenever another non-consumed modifier is enabled.
For example, with
\e[>1u
, pressingSpace
while NumLock is enabled (not pressed) results in a normal space. But e.g.Ctrl+Space
results in32;133u
. I.e. Ctrl and NumLock.The text was updated successfully, but these errors were encountered: