mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:17:12 +08:00
Read \e prefix for escape sequences as alt modifier
The \e\e\[A style is bad but iTerm and putty (alt-left) use it. The main motivation for this change is to improve fish_key_reader output. Part of #10663
This commit is contained in:
parent
d32825ba57
commit
ff476eff2d
|
@ -56,13 +56,9 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
|||
|
||||
bind --preset $argv alt-right nextd-or-forward-word
|
||||
bind --preset $argv alt-left prevd-or-backward-word
|
||||
$legacy_bind --preset $argv \e\e\[C nextd-or-forward-word # iTerm2 default
|
||||
$legacy_bind --preset $argv \e\e\[D prevd-or-backward-word # iTerm2 default
|
||||
|
||||
bind --preset $argv alt-up history-token-search-backward
|
||||
bind --preset $argv alt-down history-token-search-forward
|
||||
$legacy_bind --preset $argv \e\e\[A history-token-search-backward # iTerm2 default
|
||||
$legacy_bind --preset $argv \e\e\[B history-token-search-forward # iTerm2 default
|
||||
# Bash compatibility
|
||||
# https://github.com/fish-shell/fish-shell/issues/89
|
||||
bind --preset $argv alt-. history-token-search-backward
|
||||
|
|
|
@ -700,6 +700,17 @@ pub trait InputEventQueuer {
|
|||
}
|
||||
return None;
|
||||
};
|
||||
if next == b'\x1b' {
|
||||
return Some(
|
||||
match self.parse_escape_sequence(buffer, have_escape_prefix) {
|
||||
Some(mut nested_sequence) => {
|
||||
nested_sequence.modifiers.alt = true;
|
||||
nested_sequence
|
||||
}
|
||||
None => Key::from_raw(key::Invalid),
|
||||
},
|
||||
);
|
||||
}
|
||||
if next == b'[' {
|
||||
// potential CSI
|
||||
return Some(self.parse_csi(buffer).unwrap_or(alt('[')));
|
||||
|
|
Loading…
Reference in New Issue
Block a user