From 803b8e60a971aab0a156fbaf0dacbe8b32817295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 19 Aug 2026 20:50:09 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(app):=20the=20keys=20search?= =?UTF-8?q?=20matches=20whole=20keys,=20not=20substrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Searching f1 dragged in Fullscreen's F11 because chords matched by contains. Chords now match on whole keys (split on space and +), with the full-chord substring kept for needles that spell a combination. --- crates/app/src/menus.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/app/src/menus.rs b/crates/app/src/menus.rs index 1e26fb7..f3520b2 100644 --- a/crates/app/src/menus.rs +++ b/crates/app/src/menus.rs @@ -216,8 +216,13 @@ pub(crate) fn keys_filter(needle: &str, keymap: &Keymap) -> Vec<(usize, KeyRow)> if needle.is_empty() { return rows.collect(); } + // A chord matches on whole keys, not substrings -- "f1" must not drag in + // "f11". A needle that spells a combination still matches the whole chord. let hit = |label: &str, chord: &str| { - label.to_lowercase().contains(&needle) || chord.to_lowercase().contains(&needle) + let chord = chord.to_lowercase(); + label.to_lowercase().contains(&needle) + || chord.split([' ', '+']).any(|part| part == needle) + || (needle.contains(['+', ' ']) && chord.contains(&needle)) }; let mut out: Vec<(usize, KeyRow)> = Vec::new(); // The heading above the row being looked at, until a row under it earns it