aboutsummaryrefslogtreecommitdiff
path: root/src/persist.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-04-06 19:36:23 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-04-06 19:36:23 +0300
commitd859cf21f565e23503c6ba351c62c32c33153d77 (patch)
tree27bac56973e903da8d81820948c2a771e8d42ffe /src/persist.rs
parentcbe5c150baa147649912bb1bfad40522dc3c25f3 (diff)
fix: keep sidebar width stable and persist user resize
Diffstat (limited to 'src/persist.rs')
-rw-r--r--src/persist.rs9
1 files changed, 9 insertions, 0 deletions
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<u16>,
}
#[derive(Serialize)]
@@ -218,6 +220,7 @@ pub fn capture(
active: Option<usize>,
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]