Skip to content

@keys: Ensure single grapheme cluster and unicode normalization#10978

Open
LeonMatthes wants to merge 2 commits intoslint-ui:masterfrom
LeonMatthes:lm/102-unicode-handling
Open

@keys: Ensure single grapheme cluster and unicode normalization#10978
LeonMatthes wants to merge 2 commits intoslint-ui:masterfrom
LeonMatthes:lm/102-unicode-handling

Conversation

@LeonMatthes
Copy link
Collaborator

  • Add Unicode normalization and grapheme cluster validation for keyboard shortcuts
  • Add string-based keyboard testing API and Unicode normalization test

As discussed in #102, this ensures consistent handling for different languages.
Especially the unicode normalization is crucial to ensure keyboard shortcuts involving accents or other composed characters can be matched consistently.

@LeonMatthes LeonMatthes enabled auto-merge (rebase) March 9, 2026 08:46
LeonMatthes and others added 2 commits March 9, 2026 09:56
…d shortcuts

- Add unicode-normalization and unicode-segmentation to compiler
- NFC-normalize key strings at compile time in @keys() macro resolution
- Validate that @keys() string literals contain exactly one grapheme cluster
- Add unicode-normalization as optional dep to i-slint-core behind the
  'unicode' feature flag; NFC-normalize key event text centrally in
  WindowInner::process_key_input() so all backends benefit automatically
- Add syntax tests for multi-grapheme rejection and Unicode key support

Addresses Unicode handling items from issue slint-ui#102.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add slint_send_keyboard_key_text() to core tests: dispatches a single
  key event with the full text string, supporting multi-codepoint
  grapheme clusters (e.g. NFD-encoded é = e + combining acute)
- Refactor slint_send_keyboard_char() to use the new function internally
- Add send_keyboard_key_text() and send_keyboard_shortcut_with_text()
  to the Rust testing wrapper, refactor send_keyboard_shortcut() and
  send_keyboard_char() to reduce duplication
- Add send_keyboard_key_text() to C++ testing header, update
  send_keyboard_shortcut() to use it (fixes multi-codepoint handling)
- Add @keys("é") shortcut to keyboard_shortcut test with both NFC
  and NFD input verification in Rust and C++ tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@LeonMatthes LeonMatthes force-pushed the lm/102-unicode-handling branch from 2db63b3 to e3e4ab3 Compare March 9, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant