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:
@ -289,7 +289,12 @@ pub struct SetBuffer {
|
||||
}
|
||||
impl Effect for SetBuffer {
|
||||
fn apply(&self, app: &mut App) {
|
||||
app.buffers.insert(self.name.clone(), self.value.clone());
|
||||
// "search" is special — it writes to search_query for backward compat
|
||||
if self.name == "search" {
|
||||
app.search_query = self.value.clone();
|
||||
} else {
|
||||
app.buffers.insert(self.name.clone(), self.value.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user