Fix modifier order in keycode string generation#108260
Fix modifier order in keycode string generation#108260Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
There was a problem hiding this comment.
It looks like the chosen order is consistent with reccomendations from Windows and Mac (https://superuser.com/questions/1238058/key-combination-order). So this PR is headed in the right direction.
I believe, that it is unlikely, that this change will affect users negatively. (that would require users to process the text output, which seems a silly idea)
Calinou
left a comment
There was a problem hiding this comment.
Code looks good to me.
I suggest adding unit tests for this in tests/core/input/test_input_event_key.h (look for existing instances of as_text in that file).
|
I've added the unit tests to check for the ordering of modifier keys. |
|
I've modified the tests so they pass on MacOS! Probably! (Fixed a small oopsie with on of the conditions too 🙈) |
Fix the order in which modifier keys are appended in as_text() and keycode_get_string() to ensure consistent and logical ordering (Ctrl, Alt, Shift, Meta). Refactored keycode_get_string() to use a vector for building the key string, improving readability and maintainability.
|
I noticed #108314 Somewhat related would replace that long macos condition. |
|
Thanks! Congratulations on your first merged contribution! 🎉 |
Fix the order in which modifier keys are appended in as_text() and keycode_get_string() to ensure consistent and logical ordering (Ctrl, Alt, Shift, Meta). Refactored keycode_get_string() to use a vector for building the key string, improving readability and maintainability.
For example, creating a PopupMenu with an accelerator with ctrl, shift, n would result in the text displayed as "Shift + Ctrl + N" while adding the short cut with event N and modifiers ctrl and shift would result in text displayed as "Ctrl + Shift + N".
Both are now consistent.