refactor(navigation): include AppMode in view navigation stack

Introduce `ViewFrame` to store both the view name and the `AppMode` when
pushing to the navigation stack. Update `view_back_stack` and
`view_forward_stack` to use `ViewFrame` instead of `String` . Update
`CmdContext` and `Effect` implementations (SwitchView, ViewBack,
ViewForward) to handle the new `ViewFrame` structure. Add `is_editing()`
helper to `AppMode` .

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gemma-4-26B-A4B-it-UD-Q5_K_XL.gguf)
This commit is contained in:
Edward Langley
2026-04-15 21:32:34 -07:00
parent 23c7c530e3
commit 7c00695398
4 changed files with 49 additions and 18 deletions

View File

@ -67,7 +67,10 @@ mod tests {
let m = two_cat_model();
let layout = make_layout(&m);
let reg = make_registry();
let fwd_stack = vec!["View 2".to_string()];
let fwd_stack = vec![crate::ui::app::ViewFrame {
view_name: "View 2".to_string(),
mode: crate::ui::app::AppMode::Normal,
}];
let mut ctx = make_ctx(&m, &layout, &reg);
ctx.view_forward_stack = &fwd_stack;
let cmd = ViewNavigate { forward: true };
@ -84,7 +87,10 @@ mod tests {
let m = two_cat_model();
let layout = make_layout(&m);
let reg = make_registry();
let back_stack = vec!["Default".to_string()];
let back_stack = vec![crate::ui::app::ViewFrame {
view_name: "Default".to_string(),
mode: crate::ui::app::AppMode::Normal,
}];
let mut ctx = make_ctx(&m, &layout, &reg);
ctx.view_back_stack = &back_stack;
let cmd = ViewNavigate { forward: false };