Translate non-latin Key using Physical codes

Co-authored-by: Leonid Onokhov <sopvop@gmail.com>
Co-authored-by: edwloef <edwin.frank.loeffler@gmail.com>
This commit is contained in:
Héctor Ramón Jiménez 2025-12-02 04:01:51 +01:00
parent 3b67106419
commit e6571d7b70
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 103 additions and 20 deletions

View file

@ -902,6 +902,7 @@ where
key,
text,
modified_key,
physical_key,
..
}) => {
let state = state::<Renderer>(tree);
@ -909,8 +910,8 @@ where
if let Some(focus) = &mut state.is_focused {
let modifiers = state.keyboard_modifiers;
match key.as_ref() {
keyboard::Key::Character("c")
match key.to_latin(*physical_key) {
Some('c')
if state.keyboard_modifiers.command()
&& !self.is_secure =>
{
@ -926,7 +927,7 @@ where
shell.capture_event();
return;
}
keyboard::Key::Character("x")
Some('x')
if state.keyboard_modifiers.command()
&& !self.is_secure =>
{
@ -955,7 +956,7 @@ where
update_cache(state, &self.value);
return;
}
keyboard::Key::Character("v")
Some('v')
if state.keyboard_modifiers.command()
&& !state.keyboard_modifiers.alt() =>
{
@ -994,9 +995,7 @@ where
update_cache(state, &self.value);
return;
}
keyboard::Key::Character("a")
if state.keyboard_modifiers.command() =>
{
Some('a') if state.keyboard_modifiers.command() => {
let cursor_before = state.cursor;
state.cursor.select_all(&self.value);