bindingsToShortcuts function
(Map<ShortcutActivator, Intent> , Map<Type, Action<Intent> > )
bindingsToShortcuts(
- List<
RawKeyBinding> raw
Build the Shortcuts map for TerminalView, layering user bindings over
defaultTerminalShortcuts. Also returns the (currently empty) extra-actions
map placeholder so callers have a stable 2-tuple signature.
Implementation
(Map<ShortcutActivator, Intent>, Map<Type, Action<Intent>>) bindingsToShortcuts(
List<RawKeyBinding> raw) {
final shortcuts = <ShortcutActivator, Intent>{...defaultTerminalShortcuts};
for (final b in parseKeyBindings(raw)) {
final activator = _normalizeActivator(b.activator);
if (activator is SingleActivator) {
shortcuts.removeWhere((key, _) =>
key is SingleActivator && _singleActivatorsEqual(key, activator));
}
// Disable idiom (None/ReceiveChar): the chord is now removed; don't
// reinstall it. Other intents replace the (possibly default) binding.
if (b.intent is DisableBindingIntent) continue;
shortcuts[activator] = b.intent;
}
return (shortcuts, <Type, Action<Intent>>{});
}