A move or Enter key goes to a scoped command only when a scope around the focus binds it

binds_scoped took any command outside the app scope that the keymap lookup picked, including other panels' bindings
ranked by fallthrough or sharing. A linked set such as the Tour's Left and Right then took the arrows from every
roving group that does not act on its moves. Only a command of a scope around the focused chain counts now.
This commit is contained in:
aiongg
2026-11-12 14:32:41 +00:00
parent f48a2784d0
commit 5ce8eccb0b
@@ -572,9 +572,12 @@ pub(crate) fn binds_scoped(ctx: &Context, chord: &Chord) -> bool {
let scopes = board.scopes_around(&chain);
let (panel, outer) = scopes.split_first().map_or((None, &[][..]), |(panel, outer)| (Some(*panel), outer));
let active = Active { panel, contexts: &[], typing: false };
// The lookup also ranks panels that share with the focused one and, with fallthrough, every other panel: only
// a command of a scope around the focus counts.
let around = |command: &CommandRef| scopes.contains(&board.scope_of(command));
match keymap.lookup_nested(chord, false, &active, outer) {
Lookup::Run(command) => !is_app(board.scope_of(&command)),
Lookup::Cycle(commands) => commands.iter().any(|command| !is_app(board.scope_of(command))),
Lookup::Run(command) => around(&command),
Lookup::Cycle(commands) => commands.iter().any(around),
_ => false,
}
})