refactor(command): pre-resolve cell key and grid dimensions in CmdContext
Refactor command system to pre-resolve cell key and grid dimensions in CmdContext, eliminating repeated GridLayout construction. Key changes: - Add cell_key, row_count, col_count to CmdContext - Replace generic CmdRegistry::register with register/register_pure/register_nullary - Cell commands (clear-cell, yank, paste) now take explicit CellKey - Update keymap dispatch to use new interactive() method - Special-case "search" buffer in SetBuffer effect - Update tests to populate new context fields This reduces code duplication and makes command execution more efficient by computing layout once at context creation time. Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
This commit is contained in:
@ -165,7 +165,7 @@ impl Keymap {
|
||||
let binding = self.lookup(key, mods)?;
|
||||
match binding {
|
||||
Binding::Cmd { name, args } => {
|
||||
let cmd = registry.parse(name, args).ok()?;
|
||||
let cmd = registry.interactive(name, args, ctx).ok()?;
|
||||
Some(cmd.execute(ctx))
|
||||
}
|
||||
Binding::Prefix(sub) => Some(vec![Box::new(SetTransientKeymap(sub.clone()))]),
|
||||
@ -267,7 +267,7 @@ impl KeymapSet {
|
||||
normal.bind_args(KeyCode::Char('u'), ctrl, "scroll-rows", vec!["-5".into()]);
|
||||
|
||||
// Cell operations
|
||||
normal.bind(KeyCode::Char('x'), none, "clear-selected-cell");
|
||||
normal.bind(KeyCode::Char('x'), none, "clear-cell");
|
||||
normal.bind(KeyCode::Char('p'), none, "paste");
|
||||
|
||||
// View
|
||||
|
||||
Reference in New Issue
Block a user