diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-06 19:24:33 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-06 19:24:33 +0300 |
| commit | cbe5c150baa147649912bb1bfad40522dc3c25f3 (patch) | |
| tree | 44622605ee8972bf8cf27f2ae784a122712b00f9 /src/persist.rs | |
| parent | 62b1f5e011c46403c3b78f661a3e5a385d2ec72c (diff) | |
feat: add all-workspaces scope to agent panel
Diffstat (limited to 'src/persist.rs')
| -rw-r--r-- | src/persist.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/persist.rs b/src/persist.rs index 345fe9f7..72ac9bef 100644 --- a/src/persist.rs +++ b/src/persist.rs @@ -30,6 +30,8 @@ pub struct SessionSnapshot { pub workspaces: Vec<WorkspaceSnapshot>, pub active: Option<usize>, pub selected: usize, + #[serde(default)] + pub agent_panel_scope: crate::app::state::AgentPanelScope, } #[derive(Serialize)] @@ -215,12 +217,14 @@ pub fn capture( workspaces: &[Workspace], active: Option<usize>, selected: usize, + agent_panel_scope: crate::app::state::AgentPanelScope, ) -> SessionSnapshot { SessionSnapshot { version: SNAPSHOT_VERSION, workspaces: workspaces.iter().map(capture_workspace).collect(), active, selected, + agent_panel_scope, } } @@ -556,6 +560,7 @@ mod tests { workspaces: vec![], active: None, selected: 0, + agent_panel_scope: crate::app::state::AgentPanelScope::CurrentWorkspace, }; let json = serde_json::to_string(&snap).unwrap(); let restored: SessionSnapshot = serde_json::from_str(&json).unwrap(); @@ -624,6 +629,7 @@ mod tests { }], active: Some(0), selected: 0, + agent_panel_scope: crate::app::state::AgentPanelScope::CurrentWorkspace, version: SNAPSHOT_VERSION, }; @@ -642,6 +648,28 @@ mod tests { restored.workspaces[0].tabs[0].panes[&0].cwd, PathBuf::from("/home/can/Projects/herdr") ); + assert_eq!( + restored.agent_panel_scope, + crate::app::state::AgentPanelScope::CurrentWorkspace + ); + } + + #[test] + fn old_snapshot_defaults_agent_panel_scope() { + let json = serde_json::json!({ + "version": SNAPSHOT_VERSION, + "workspaces": [], + "active": null, + "selected": 0 + }) + .to_string(); + + let restored: SessionSnapshot = serde_json::from_str(&json).unwrap(); + + assert_eq!( + restored.agent_panel_scope, + crate::app::state::AgentPanelScope::CurrentWorkspace + ); } #[test] |
