-
Notifications
You must be signed in to change notification settings - Fork 815
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
tweak key reporting #4861
tweak key reporting #4861
Conversation
Will this break existing apps with bindings for |
It would. I've added a note in the changelog. |
Just had a thought about this - isn't it a bit strange to have this reported like this but not have "E" be reported as "shift+e"? I'm not sure which is better, but I'd definitely expect it to be consistent. |
There isn't a simple one to one mapping of shift + letter. It depends on your keyboard and locale. e.g. shift+3 will give a I think its safer to trust that when the keyboard produces a key, that's what the user intended, and we don't want to make assumptions about how it was produced. |
Actually, I think I just talked myself out of part of this update. When the keyboard reports an alphanumeric letter, Kitty does not report that the shift modifier was pressed. It does report the shift modifier for non alphanumeric keys. i.e. So I don't think Textual should be trying to deduce that shift was pressed at all. So |
CHANGELOG.md
Outdated
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
|
|||
- Added `tooltip` to Binding https://github.com/Textualize/textual/pull/4859 | |||
|
|||
### Changed | |||
|
|||
- Change to how keys with modifiers are reported. When shift + another modifier is pressed, then the key name will contain "shift", and the key will be *lower case*. i.e. `ctrl+shift+E` and not `ctrl+E` https://github.com/Textualize/textual/pull/4861 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need updating to match the latest state of the PR?
Some tweaks to how keys are reported (with the Kitty protocol).
"ctrl+E"
. Now it is reported as"ctrl+shft+e"
.I think this makes sense, as such a combination is unlikely intended to be a printable key.
caps_lock
andnum_lock
modifiers. This resulted in shift + key, and caps_lock + key being considered as different keys -- which I don't think makes sense. If this is ever a requirement, I think we should add booleans to the Key event.