Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert terminal: Add Alt key bindings for terminal #15535

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/settings/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
97 changes: 0 additions & 97 deletions crates/terminal/src/mappings/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion crates/terminal/src/terminal_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub struct TerminalSettingsContent {
pub alternate_scroll: Option<AlternateScroll>,
/// Sets whether the option key behaves as the meta key.
///
/// Default: false
/// Default: true
pub option_as_meta: Option<bool>,
/// Whether or not selecting text in the terminal will automatically
/// copy to the system clipboard.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/configuring-zed.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading