examples/ime: fix crash on wayland

When pressing Ctrl+Space, KeyEvent::text_with_all_modifiers would return
\0. That would get included in the text-input text. When an input method
gets activated, the invalid string returning \0 would get sent as
surrounding text, resulting in a Wayland protocol error and crashing the
application.
This commit is contained in:
DorotaC
2025-10-29 05:40:30 +01:00
committed by GitHub
parent bd6fef1d80
commit f41897cfa4
2 changed files with 4 additions and 3 deletions

View File

@@ -788,9 +788,10 @@ pub struct KeyEvent {
/// ```
pub repeat: bool,
/// Similar to [`text`][Self::text], except that this is affected by <kbd>Ctrl</kbd>.
/// Similar to [`text`][Self::text], except that this is affected by <kbd>Ctrl</kbd> and may
/// produce ASCII control characters.
///
/// For example, pressing <kbd>Ctrl</kbd>+<kbd>a</kbd> produces `Some("\x01")`.
/// For example, pressing <kbd>Ctrl</kbd>+<kbd>space</kbd> produces `Some("\x00")`.
///
/// ## Platform-specific
///