mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-23 04:51:16 -03:00
Fix new-style bindings shadowing raw escape sequence bindings
Given bind up "echo user up, new notation" bind \e\[A "echo user up, legacy notation" prior tob9d9e7edc6(Match bindings with explicit shift first, 2025-05-24), we prioritized the legacy notation because input_mapping_insert_sorted() makes us try longer sequences first -- and "up" is only one key compared to the three-key legacy sequence. This prioritization was broken inb9d9e7edc6, causing plugins that update to the "bind up" notation to break users who haven't (#11803). Even worse, it caused preset bindings to shadow user ones: bind --preset up "echo preset up, new notation" bind \e\[A "echo user up, legacy notation" Restore backwards compatibility by treating matches against legacy notation like exact matches again. (cherry picked from commit9a04c15894)
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
fish 4.0.7 (released September 18, 2025)
|
||||
========================================
|
||||
|
||||
This release fixes a regression in 4.0.6 that caused user bindings to be shadowed by either fish's or a plugin's bindings (:issue:`11803`).
|
||||
|
||||
--------------
|
||||
|
||||
fish 4.0.6 (released September 12, 2025)
|
||||
========================================
|
||||
|
||||
|
||||
12
src/input.rs
12
src/input.rs
@@ -589,11 +589,7 @@ fn next_is_char(
|
||||
actual_seq.len()
|
||||
)
|
||||
);
|
||||
return Some(if matches!(style, KeyNameStyle::Terminfo(_)) {
|
||||
KeyMatchQuality::Exact
|
||||
} else {
|
||||
KeyMatchQuality::Legacy
|
||||
});
|
||||
return Some(KeyMatchQuality::Exact);
|
||||
}
|
||||
if key.modifiers == Modifiers::ALT && seq_char == '\x1b' {
|
||||
if self.subidx + 1 == actual_seq.len() {
|
||||
@@ -613,11 +609,7 @@ fn next_is_char(
|
||||
self.subidx = 0;
|
||||
}
|
||||
FLOG!(reader, format!("matched {key} against raw escape sequence"));
|
||||
return Some(if matches!(style, KeyNameStyle::Terminfo(_)) {
|
||||
KeyMatchQuality::Exact
|
||||
} else {
|
||||
KeyMatchQuality::Legacy
|
||||
});
|
||||
return Some(KeyMatchQuality::Exact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,6 @@ fn apply_shift(mut key: Key, do_ascii: bool, shifted_codepoint: char) -> Option<
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum KeyMatchQuality {
|
||||
Legacy,
|
||||
BaseLayoutModuloShift,
|
||||
BaseLayout,
|
||||
ModuloShift,
|
||||
|
||||
Reference in New Issue
Block a user