feat(records): implement records mode for data entry
Implement a new "Records" mode for data entry. - Add `RecordsNormal` and `RecordsEditing` to `AppMode` and `ModeKey` . - `DataStore` now uses `IndexMap` and supports `sort_by_key()` to ensure deterministic row order. - `ToggleRecordsMode` command now sorts data and switches to `RecordsNormal` . - `EnterEditMode` command now respects records editing variants. - `RecordsNormal` mode includes a new `o` keybinding to add a record row. - `RecordsEditing` mode inherits from `Editing` and adds an `Esc` binding to return to `RecordsNormal` . - Added `SortData` effect to trigger data sorting. - Updated UI to display "RECORDS" and "RECORDS INSERT" mode names and styles. - Updated keymaps, command registry, and view navigation to support these new modes. - Added comprehensive tests for records mode behavior, including sorting and boundary conditions for Tab/Enter. Co-Authored-By: fiddlerwoaroof/git-smart-commit (gemma-4-26B-A4B-it-UD-Q5_K_XL.gguf)
This commit is contained in:
@ -197,13 +197,18 @@ impl Cmd for EnterEditMode {
|
||||
fn name(&self) -> &'static str {
|
||||
"enter-edit-mode"
|
||||
}
|
||||
fn execute(&self, _ctx: &CmdContext) -> Vec<Box<dyn Effect>> {
|
||||
fn execute(&self, ctx: &CmdContext) -> Vec<Box<dyn Effect>> {
|
||||
let edit_mode = if ctx.mode.is_records() {
|
||||
AppMode::records_editing()
|
||||
} else {
|
||||
AppMode::editing()
|
||||
};
|
||||
vec![
|
||||
Box::new(effect::SetBuffer {
|
||||
name: "edit".to_string(),
|
||||
value: self.initial_value.clone(),
|
||||
}),
|
||||
effect::change_mode(AppMode::editing()),
|
||||
effect::change_mode(edit_mode),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user