fix: arrow keys in text editor on a layer_surface

This commit is contained in:
Hojjat 2026-09-21 21:23:13 -06:00 • committed by Ashley Wulber
parent 6f1b3a7170
commit 0968a10fc1

View file

@ -627,7 +627,12 @@ impl SctkEvent {
keyboard::Event::KeyPressed { keyboard::Event::KeyPressed {
key: key.clone(), key: key.clone(),
location: location, location: location,
text: ke.utf8.map(|s| s.into()), // sctk reports keys without a text representation (e.g. arrows, Home) as
// Some("") but winit reports None. Widgets are written against winit's contract.
text: ke
.utf8
.filter(|s| !s.is_empty())
.map(|s| s.into()),
modifiers: modifiers_to_native(*modifiers), modifiers: modifiers_to_native(*modifiers),
physical_key, physical_key,
repeat: false, repeat: false,
@ -653,7 +658,9 @@ impl SctkEvent {
keyboard::Event::KeyPressed { keyboard::Event::KeyPressed {
key: key.clone(), key: key.clone(),
location: location, location: location,
text: utf8.map(|s| s.into()), text: utf8
.filter(|s| !s.is_empty())
.map(|s| s.into()),
modifiers: modifiers_to_native(*modifiers), modifiers: modifiers_to_native(*modifiers),
physical_key, physical_key,
repeat: true, repeat: true,