Skip to content
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 Control+Shift+U (rebindable) action for Unicode input, show hex as it is entered. #96592

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Sep 5, 2024

Implements and closes godotengine/godot-proposals#10654

  • Adds ui_unicode_start action (set to Control+Shift+U by default) start Unicode hex input (code submitted/canceled by ui_text_submit/ui_cancel actions).
  • Adds hex code display (for both Alt+ and new action).
Screen.Recording.2024-09-05.at.18.18.48.mov

@bruvzg bruvzg added this to the 4.x milestone Sep 5, 2024
@bruvzg bruvzg marked this pull request as ready for review September 5, 2024 15:19
@bruvzg bruvzg requested review from a team as code owners September 5, 2024 15:19
@akien-mga akien-mga changed the title Add Control+Shift+U (rebindabe) action for Unicode input, show hex as it is entered. Add Control+Shift+U (rebindable) action for Unicode input, show hex as it is entered. Sep 5, 2024
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on Fedora 40 KDE X11, there are some issues when you use Shift + home row keys to enter numbers on a French AZERTY (fr-oss) keyboard layout. It remains stuck after you press other keys such as arrow keys:

unicode_input.mp4

Using screenkey to show pressed keys.

This does not occur when using the numpad to enter numbers, as seen at the end of the video above.

@bruvzg
Copy link
Member Author

bruvzg commented Sep 6, 2024

It remains stuck after you press other keys such as arrow keys:

Is it supposed to do something until you press Enter/Esc to commit/cancel it? (Video seems to only show static frame with Ctrl+R visible, not sure if it's an issue with recording or Firefox, and downloaded video refuse to open at all).

@akien-mga
Copy link
Member

It remains stuck after you press other keys such as arrow keys:

Is it supposed to do something until you press Enter/Esc to commit/cancel it? (Video seems to only show static frame with Ctrl+R visible, not sure if it's an issue with recording or Firefox, and downloaded video refuse to open at all).

For the record, I tested the same feature in Firefox, and it seems to accept the following keys to end the edit mode and process the character:

  • Enter/Return
  • Space
  • Ctrl
  • Shift

Ctrl and Shift are maybe a bit far fetched, but in our implementation I'd feel natural for Space to work too. Or we could support the same keys as Firefox for convenience. That being said I see merit in using ui_text_submit over ui_accept, so maybe it's fine as is.

@akien-mga
Copy link
Member

Tested locally on Fedora 40 KDE X11, there are some issues when you use Shift + home row keys to enter numbers on a French AZERTY (fr-oss) keyboard layout. It remains stuck after you press other keys such as arrow keys:

I confirm that with a French keyboard the main number keys can't be used.

After pressing Ctrl+Shift+U:

  • Pressing é à & " (first-level keys on the 2 0 1 3 key positions) inputs only 20
  • Pressing Shift+é (2) Shift+à (0) Shift+& (1) Shift+" (3) also only inputs 20

@KoBeWi
Copy link
Member

KoBeWi commented Sep 6, 2024

The behavior is weird when you move the caret:

GR9HB1XCsV.mp4

@bruvzg
Copy link
Member Author

bruvzg commented Sep 6, 2024

The behavior is weird when you move the caret

This is a side effect of #87479 (this change seems fine, but I have not accounted for this behavior, the same change probably should be done for LineEdit), should be fixed now.

Pressing é à & " (first-level keys on the 2 0 1 3 key positions) inputs only 20
Pressing Shift+é (2) Shift+à (0) Shift+& (1) Shift+" (3) also only inputs 20

Should work now, both with and w/o Shift (tested on macOS), I forgot there are keyboard layouts with non-primary level numbers.

That being said I see merit in using ui_text_submit over ui_accept, so maybe it's fine as is.

Changed it to use both ui_accept and ui_text_submit, not sure about Shift and Ctrl.

@bruvzg
Copy link
Member Author

bruvzg commented Sep 6, 2024

this change seems fine, but I have not accounted for this behavior, the same change probably should be done for LineEdit

Updated LineEdit to handle IME and this in the same way TextEdit do.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebase, and should be good to merge.

@akien-mga akien-mga merged commit b60e16f into godotengine:master Sep 13, 2024
20 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for [Ctrl]+[Shift]+[U] unicode input on at least Linux
4 participants