From 7783505beecd3dec19ec781b2fedfc0b6b30084e Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 17 Sep 2025 14:49:24 +0200 Subject: [PATCH] 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 to b9d9e7edc65 (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 in b9d9e7edc65, 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 commit 9a04c15894b10621b72ac3814ec712ab5e3cfa3b) --- CHANGELOG.rst | 7 +++++++ src/input.rs | 12 ++---------- src/input_common.rs | 1 - 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 89b8ca321..ffc959b97 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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) ======================================== diff --git a/src/input.rs b/src/input.rs index 20d959a3c..8d328ebfd 100644 --- a/src/input.rs +++ b/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); } } } diff --git a/src/input_common.rs b/src/input_common.rs index c94d8052c..562ff5650 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -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,