From d859cf21f565e23503c6ba351c62c32c33153d77 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Mon, 6 Apr 2026 19:36:23 +0300 Subject: fix: keep sidebar width stable and persist user resize --- src/persist.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/persist.rs') diff --git a/src/persist.rs b/src/persist.rs index 72ac9bef..292af92d 100644 --- a/src/persist.rs +++ b/src/persist.rs @@ -32,6 +32,8 @@ pub struct SessionSnapshot { pub selected: usize, #[serde(default)] pub agent_panel_scope: crate::app::state::AgentPanelScope, + #[serde(default)] + pub sidebar_width: Option, } #[derive(Serialize)] @@ -218,6 +220,7 @@ pub fn capture( active: Option, selected: usize, agent_panel_scope: crate::app::state::AgentPanelScope, + sidebar_width: u16, ) -> SessionSnapshot { SessionSnapshot { version: SNAPSHOT_VERSION, @@ -225,6 +228,7 @@ pub fn capture( active, selected, agent_panel_scope, + sidebar_width: Some(sidebar_width), } } @@ -561,11 +565,13 @@ mod tests { active: None, selected: 0, agent_panel_scope: crate::app::state::AgentPanelScope::CurrentWorkspace, + sidebar_width: Some(26), }; let json = serde_json::to_string(&snap).unwrap(); let restored: SessionSnapshot = serde_json::from_str(&json).unwrap(); assert!(restored.workspaces.is_empty()); assert_eq!(restored.active, None); + assert_eq!(restored.sidebar_width, Some(26)); } #[test] @@ -630,6 +636,7 @@ mod tests { active: Some(0), selected: 0, agent_panel_scope: crate::app::state::AgentPanelScope::CurrentWorkspace, + sidebar_width: Some(26), version: SNAPSHOT_VERSION, }; @@ -652,6 +659,7 @@ mod tests { restored.agent_panel_scope, crate::app::state::AgentPanelScope::CurrentWorkspace ); + assert_eq!(restored.sidebar_width, Some(26)); } #[test] @@ -670,6 +678,7 @@ mod tests { restored.agent_panel_scope, crate::app::state::AgentPanelScope::CurrentWorkspace ); + assert_eq!(restored.sidebar_width, None); } #[test] -- cgit v1.2.3