feat(command): add CmdContext extensions and new effects

Add new fields to CmdContext for tracking search mode, panel cursors,
tile category index, named text buffers, and key information.

Add SetBuffer and SetTileCatIdx effects for managing application state.
Update TileBar to accept tile_cat_idx parameter for rendering.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
This commit is contained in:
Edward Langley
2026-04-04 09:58:30 -07:00
parent 56839b81d2
commit b7e4316cef
4 changed files with 41 additions and 5 deletions

View File

@ -1,5 +1,8 @@
use std::collections::HashMap;
use std::fmt::Debug;
use crossterm::event::{KeyCode, KeyModifiers};
use crate::model::cell::CellValue;
use crate::model::Model;
use crate::ui::app::AppMode;
@ -17,9 +20,21 @@ pub struct CmdContext<'a> {
pub yanked: &'a Option<CellValue>,
pub dirty: bool,
pub file_path_set: bool,
pub search_mode: bool,
pub formula_panel_open: bool,
pub category_panel_open: bool,
pub view_panel_open: bool,
/// Panel cursors
pub formula_cursor: usize,
pub cat_panel_cursor: usize,
pub view_panel_cursor: usize,
/// Tile select cursor (which category is selected)
pub tile_cat_idx: usize,
/// Named text buffers
pub buffers: &'a HashMap<String, String>,
/// The key that triggered this command
pub key_code: KeyCode,
pub key_modifiers: KeyModifiers,
}
/// A command that reads state and produces effects.