From 64bfec533e0a398309d4a51c16cd251b6460a120 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Wed, 31 Jul 2024 10:54:58 -0400 Subject: [PATCH] Revert terminal: Add Alt key bindings for terminal (#15535) - reverts commit 66ada3e44c047d828efbc269655476c12eefe876. - change default `option_as_meta` to true --- assets/settings/default.json | 2 +- crates/terminal/src/mappings/keys.rs | 97 ------------------------ crates/terminal/src/terminal_settings.rs | 2 +- docs/src/configuring-zed.md | 2 +- 4 files changed, 3 insertions(+), 100 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index f3d6dfef58475..007eba7d175cd 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -635,7 +635,7 @@ // "option_to_meta": false, // 2. Make the option keys behave as a 'meta' key, e.g. for emacs // "option_to_meta": true, - "option_as_meta": false, + "option_as_meta": true, // Whether or not selecting text in the terminal will automatically // copy to the system clipboard. "copy_on_select": false, diff --git a/crates/terminal/src/mappings/keys.rs b/crates/terminal/src/mappings/keys.rs index d4282a61cee48..e760db3616fea 100644 --- a/crates/terminal/src/mappings/keys.rs +++ b/crates/terminal/src/mappings/keys.rs @@ -192,103 +192,6 @@ pub fn to_esc_str(keystroke: &Keystroke, mode: &TermMode, alt_is_meta: bool) -> ("^", AlacModifiers::Ctrl) => Some("\x1e".to_string()), //30 ("_", AlacModifiers::Ctrl) => Some("\x1f".to_string()), //31 ("?", AlacModifiers::Ctrl) => Some("\x7f".to_string()), //127 - // Mapping of Alt+key; emacs meta key: M- - ("a", AlacModifiers::Alt) => Some("\x1ba".to_string()), - ("A", AlacModifiers::Alt) => Some("\x1bA".to_string()), - ("b", AlacModifiers::Alt) => Some("\x1bb".to_string()), - ("B", AlacModifiers::Alt) => Some("\x1bB".to_string()), - ("c", AlacModifiers::Alt) => Some("\x1bc".to_string()), - ("C", AlacModifiers::Alt) => Some("\x1bC".to_string()), - ("d", AlacModifiers::Alt) => Some("\x1bd".to_string()), - ("D", AlacModifiers::Alt) => Some("\x1bD".to_string()), - ("e", AlacModifiers::Alt) => Some("\x1be".to_string()), - ("E", AlacModifiers::Alt) => Some("\x1bE".to_string()), - ("f", AlacModifiers::Alt) => Some("\x1bf".to_string()), - ("F", AlacModifiers::Alt) => Some("\x1bF".to_string()), - ("g", AlacModifiers::Alt) => Some("\x1bg".to_string()), - ("G", AlacModifiers::Alt) => Some("\x1bG".to_string()), - ("h", AlacModifiers::Alt) => Some("\x1bh".to_string()), - ("H", AlacModifiers::Alt) => Some("\x1bH".to_string()), - ("i", AlacModifiers::Alt) => Some("\x1bi".to_string()), - ("I", AlacModifiers::Alt) => Some("\x1bI".to_string()), - ("j", AlacModifiers::Alt) => Some("\x1bj".to_string()), - ("J", AlacModifiers::Alt) => Some("\x1bJ".to_string()), - ("k", AlacModifiers::Alt) => Some("\x1bk".to_string()), - ("K", AlacModifiers::Alt) => Some("\x1bK".to_string()), - ("l", AlacModifiers::Alt) => Some("\x1bl".to_string()), - ("L", AlacModifiers::Alt) => Some("\x1bL".to_string()), - ("m", AlacModifiers::Alt) => Some("\x1bm".to_string()), - ("M", AlacModifiers::Alt) => Some("\x1bM".to_string()), - ("n", AlacModifiers::Alt) => Some("\x1bn".to_string()), - ("N", AlacModifiers::Alt) => Some("\x1bN".to_string()), - ("o", AlacModifiers::Alt) => Some("\x1bo".to_string()), - ("O", AlacModifiers::Alt) => Some("\x1bO".to_string()), - ("p", AlacModifiers::Alt) => Some("\x1bp".to_string()), - ("P", AlacModifiers::Alt) => Some("\x1bP".to_string()), - ("q", AlacModifiers::Alt) => Some("\x1bq".to_string()), - ("Q", AlacModifiers::Alt) => Some("\x1bQ".to_string()), - ("r", AlacModifiers::Alt) => Some("\x1br".to_string()), - ("R", AlacModifiers::Alt) => Some("\x1bR".to_string()), - ("s", AlacModifiers::Alt) => Some("\x1bs".to_string()), - ("S", AlacModifiers::Alt) => Some("\x1bS".to_string()), - ("t", AlacModifiers::Alt) => Some("\x1bt".to_string()), - ("T", AlacModifiers::Alt) => Some("\x1bT".to_string()), - ("u", AlacModifiers::Alt) => Some("\x1bu".to_string()), - ("U", AlacModifiers::Alt) => Some("\x1bU".to_string()), - ("v", AlacModifiers::Alt) => Some("\x1bv".to_string()), - ("V", AlacModifiers::Alt) => Some("\x1bV".to_string()), - ("w", AlacModifiers::Alt) => Some("\x1bw".to_string()), - ("W", AlacModifiers::Alt) => Some("\x1bW".to_string()), - ("x", AlacModifiers::Alt) => Some("\x1bx".to_string()), - ("X", AlacModifiers::Alt) => Some("\x1bX".to_string()), - ("y", AlacModifiers::Alt) => Some("\x1by".to_string()), - ("Y", AlacModifiers::Alt) => Some("\x1bY".to_string()), - ("z", AlacModifiers::Alt) => Some("\x1bz".to_string()), - ("Z", AlacModifiers::Alt) => Some("\x1bZ".to_string()), - // Emacs Numeric arguments / prefix arguments - ("0", AlacModifiers::Alt) => Some("\x1b0".to_string()), - ("1", AlacModifiers::Alt) => Some("\x1b1".to_string()), - ("2", AlacModifiers::Alt) => Some("\x1b2".to_string()), - ("3", AlacModifiers::Alt) => Some("\x1b3".to_string()), - ("4", AlacModifiers::Alt) => Some("\x1b4".to_string()), - ("5", AlacModifiers::Alt) => Some("\x1b5".to_string()), - ("6", AlacModifiers::Alt) => Some("\x1b6".to_string()), - ("7", AlacModifiers::Alt) => Some("\x1b7".to_string()), - ("8", AlacModifiers::Alt) => Some("\x1b8".to_string()), - ("9", AlacModifiers::Alt) => Some("\x1b9".to_string()), - // Various Emacs Meta key combinations - ("!", AlacModifiers::Alt) => Some("\x1b!".to_string()), - // ("\"", AlacModifiers::Alt) => Some("\x1b\"".to_string()), - // ("#", AlacModifiers::Alt) => Some("\x1b#".to_string()), - ("$", AlacModifiers::Alt) => Some("\x1b$".to_string()), - ("%", AlacModifiers::Alt) => Some("\x1b%".to_string()), - ("&", AlacModifiers::Alt) => Some("\x1b&".to_string()), - ("'", AlacModifiers::Alt) => Some("\x1b'".to_string()), - ("(", AlacModifiers::Alt) => Some("\x1b(".to_string()), - (")", AlacModifiers::Alt) => Some("\x1b)".to_string()), - // ("*", AlacModifiers::Alt) => Some("\x1b*".to_string()), - // ("+", AlacModifiers::Alt) => Some("\x1b+".to_string()), - (",", AlacModifiers::Alt) => Some("\x1b,".to_string()), - ("-", AlacModifiers::Alt) => Some("\x1b-".to_string()), - (".", AlacModifiers::Alt) => Some("\x1b.".to_string()), - ("/", AlacModifiers::Alt) => Some("\x1b/".to_string()), - (":", AlacModifiers::Alt) => Some("\x1b:".to_string()), - (";", AlacModifiers::Alt) => Some("\x1b;".to_string()), - ("<", AlacModifiers::Alt) => Some("\x1b<".to_string()), - ("=", AlacModifiers::Alt) => Some("\x1b=".to_string()), - (">", AlacModifiers::Alt) => Some("\x1b>".to_string()), - ("?", AlacModifiers::Alt) => Some("\x1b?".to_string()), - ("@", AlacModifiers::Alt) => Some("\x1b@".to_string()), - // ("[", AlacModifiers::Alt) => Some("\x1b[".to_string()), - ("\\", AlacModifiers::Alt) => Some("\x1b\\".to_string()), - // ("]", AlacModifiers::Alt) => Some("\x1b]".to_string()), - ("^", AlacModifiers::Alt) => Some("\x1b^".to_string()), - // ("_", AlacModifiers::Alt) => Some("\x1b_".to_string()), - ("`", AlacModifiers::Alt) => Some("\x1b`".to_string()), - ("{", AlacModifiers::Alt) => Some("\x1b{".to_string()), - ("|", AlacModifiers::Alt) => Some("\x1b|".to_string()), - ("}", AlacModifiers::Alt) => Some("\x1b}".to_string()), - ("~", AlacModifiers::Alt) => Some("\x1b~".to_string()), _ => None, }; if manual_esc_str.is_some() { diff --git a/crates/terminal/src/terminal_settings.rs b/crates/terminal/src/terminal_settings.rs index 8d3de1dc4ce87..6c95052612401 100644 --- a/crates/terminal/src/terminal_settings.rs +++ b/crates/terminal/src/terminal_settings.rs @@ -141,7 +141,7 @@ pub struct TerminalSettingsContent { pub alternate_scroll: Option, /// Sets whether the option key behaves as the meta key. /// - /// Default: false + /// Default: true pub option_as_meta: Option, /// Whether or not selecting text in the terminal will automatically /// copy to the system clipboard. diff --git a/docs/src/configuring-zed.md b/docs/src/configuring-zed.md index 04703c10952d8..083682fb00e07 100644 --- a/docs/src/configuring-zed.md +++ b/docs/src/configuring-zed.md @@ -1252,7 +1252,7 @@ List of `integer` column numbers "font_family": null, "font_features": null, "font_size": null, - "option_as_meta": false, + "option_as_meta": true, "button": false, "shell": {}, "toolbar": {