refactor(command): improve formula commitment and buffer management

Refactor command execution and buffer management.

- `CommitFormula` now defaults to targeting `_Measure` .
- `CommitFormula` no longer automatically clears the buffer; buffer
  clearing is now handled by keymap sequences.
- Added `ClearBufferCmd` to the command registry.
- Updated `AddFormulaCmd` to support optional target category.
- Added `SetBuffer` effect to allow clearing buffers.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/gemma-4-26B-A4B-it-GGUF:UD-Q5_K_XL)
This commit is contained in:
Edward Langley
2026-04-09 14:24:39 -07:00
parent c3fb8669c2
commit 7fea5f67ed
4 changed files with 62 additions and 29 deletions

View File

@ -1252,6 +1252,23 @@ mod tests {
assert_eq!(app.mode, AppMode::Help);
}
/// SetBuffer with empty value clears the buffer (used by clear-buffer command
/// in keymap sequences after commit).
#[test]
fn set_buffer_empty_clears() {
let mut app = test_app();
app.buffers.insert("formula".to_string(), "old text".to_string());
SetBuffer {
name: "formula".to_string(),
value: String::new(),
}
.apply(&mut app);
assert_eq!(
app.buffers.get("formula").map(|s| s.as_str()),
Some(""),
);
}
#[test]
fn set_status_effect() {
let mut app = test_app();