Fix ctrl-q on AZERTY on Linux (#34597)

Conrad Irwin created

Closes #ISSUE

Release Notes:

- N/A

Change summary

crates/gpui/src/platform/linux/platform.rs | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

Detailed changes

crates/gpui/src/platform/linux/platform.rs 🔗

@@ -822,14 +822,28 @@ impl crate::Keystroke {
             Keysym::underscore => "_".to_owned(),
             Keysym::equal => "=".to_owned(),
             Keysym::plus => "+".to_owned(),
+            Keysym::space => "space".to_owned(),
+            Keysym::BackSpace => "backspace".to_owned(),
+            Keysym::Tab => "tab".to_owned(),
+            Keysym::Delete => "delete".to_owned(),
+            Keysym::Escape => "escape".to_owned(),
 
             _ => {
                 let name = xkb::keysym_get_name(key_sym).to_lowercase();
                 if key_sym.is_keypad_key() {
                     name.replace("kp_", "")
-                } else if key_utf8.len() == 1 && key_utf8.chars().next().unwrap().is_ascii_graphic()
+                } else if let Some(key) = key_utf8.chars().next()
+                    && key_utf8.len() == 1
+                    && key.is_ascii()
                 {
-                    key_utf8.clone()
+                    if key.is_ascii_graphic() {
+                        key_utf8.clone()
+                    // map ctrl-a to a
+                    } else if key_utf32 <= 0x1f {
+                        ((key_utf32 as u8 + 0x60) as char).to_string()
+                    } else {
+                        name
+                    }
                 } else if let Some(key_en) = guess_ascii(keycode, modifiers.shift) {
                     String::from(key_en)
                 } else {