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:
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user