mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 02:32:33 +00:00
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:
@@ -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,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user