Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Conrad Irwin1ce384bbda2a
diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs
index 1e901387b02..a24838339ed 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 {