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.

Ignore "Option as Meta" setting outside of macOS (#42367)

John Turaaf2f9d30919
diff --git a/crates/terminal/src/mappings/keys.rs b/crates/terminal/src/mappings/keys.rs
index b003bf82ad3..8073961fc54 100644
--- a/crates/terminal/src/mappings/keys.rs
+++ b/crates/terminal/src/mappings/keys.rs
@@ -46,7 +46,7 @@ impl AlacModifiers {
pub fn to_esc_str(
keystroke: &Keystroke,
mode: &TermMode,
- alt_is_meta: bool,
+ option_as_meta: bool,
) -> Option<Cow<'static, str>> {
let modifiers = AlacModifiers::new(keystroke);
@@ -218,7 +218,7 @@ pub fn to_esc_str(
}
}
- if alt_is_meta {
+ if !cfg!(target_os = "macos") || option_as_meta {
let is_alt_lowercase_ascii = modifiers == AlacModifiers::Alt && keystroke.key.is_ascii();
let is_alt_uppercase_ascii =
keystroke.modifiers.alt && keystroke.modifiers.shift && keystroke.key.is_ascii();
diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs
index 8283f5fad77..4f6f0e75ee6 100644
--- a/crates/terminal/src/terminal.rs
+++ b/crates/terminal/src/terminal.rs
@@ -1490,14 +1490,14 @@ impl Terminal {
}
}
- pub fn try_keystroke(&mut self, keystroke: &Keystroke, alt_is_meta: bool) -> bool {
+ pub fn try_keystroke(&mut self, keystroke: &Keystroke, option_as_meta: bool) -> bool {
if self.vi_mode_enabled {
self.vi_motion(keystroke);
return true;
}
// Keep default terminal behavior
- let esc = to_esc_str(keystroke, &self.last_content.mode, alt_is_meta);
+ let esc = to_esc_str(keystroke, &self.last_content.mode, option_as_meta);
if let Some(esc) = esc {
match esc {
Cow::Borrowed(string) => self.input(string.as_bytes()),