From 1ce384bbda2afa90069eac4f9d36c342cd860f8c Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 16 Jul 2025 21:27:46 -0600 Subject: [PATCH] Fix ctrl-q on AZERTY on Linux (#34597) Closes #ISSUE Release Notes: - N/A --- crates/gpui/src/platform/linux/platform.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 1e901387b0..a24838339e 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/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 {