refactor(command): decouple keymap bindings from command implementations
Refactor the keymap system to use string-based command names instead of concrete command struct instantiations. This introduces a Binding enum that can represent either a command lookup (name + args) or a prefix sub-keymap. Key changes: - Keymap now stores Binding enum instead of Arc<dyn Cmd> - dispatch() accepts CmdRegistry to resolve commands at runtime - Added bind_args() for commands with arguments - KeymapSet now owns the command registry - Removed PrefixKey struct, inlined its logic - Updated all default keymap bindings to use string names This enables more flexible command configuration and easier testing. Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
This commit is contained in:
@ -141,7 +141,8 @@ impl App {
|
||||
if let Some(transient) = self.transient_keymap.take() {
|
||||
let effects = {
|
||||
let ctx = self.cmd_context(key.code, key.modifiers);
|
||||
transient.dispatch(&ctx, key.code, key.modifiers)
|
||||
self.keymap_set
|
||||
.dispatch_transient(&transient, &ctx, key.code, key.modifiers)
|
||||
};
|
||||
if let Some(effects) = effects {
|
||||
self.apply_effects(effects);
|
||||
|
||||
Reference in New Issue
Block a user