diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-14 20:40:11 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-14 20:41:20 +0300 |
| commit | 5b91dae12ffa09f5842a0c852ef06299c31fe342 (patch) | |
| tree | 86562e2fb20207f69998cbcc931c570901b99892 /src/config | |
| parent | b0d46fb9bc2a3e7fb58864939e2580b8a9a2f1bc (diff) | |
feat: configure sidebar entry gaps
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/sidebar.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/config/sidebar.rs b/src/config/sidebar.rs index d0ae5240..e583f5af 100644 --- a/src/config/sidebar.rs +++ b/src/config/sidebar.rs @@ -6,6 +6,7 @@ use crate::detect::Agent; const MAX_SIDEBAR_ROWS: usize = 16; const MAX_SIDEBAR_TOKENS_PER_ROW: usize = 16; +const DEFAULT_SIDEBAR_ROW_GAP: u16 = 0; fn deserialize_sidebar_rows<'de, D, T>(deserializer: D) -> Result<Vec<Vec<T>>, D::Error> where @@ -198,6 +199,7 @@ pub struct AgentsSidebarConfig { pub rows: AgentSidebarRows, #[serde(default, deserialize_with = "deserialize_rows_by_agent")] pub rows_by_agent: BTreeMap<String, AgentSidebarRows>, + pub row_gap: u16, } impl AgentsSidebarConfig { @@ -220,6 +222,7 @@ impl Default for AgentsSidebarConfig { vec![AgentSidebarToken::Agent], ], rows_by_agent: BTreeMap::new(), + row_gap: DEFAULT_SIDEBAR_ROW_GAP, } } } @@ -229,6 +232,7 @@ impl Default for AgentsSidebarConfig { pub struct SpacesSidebarConfig { #[serde(deserialize_with = "deserialize_sidebar_rows")] pub rows: SpaceSidebarRows, + pub row_gap: u16, } impl Default for SpacesSidebarConfig { @@ -238,6 +242,7 @@ impl Default for SpacesSidebarConfig { vec![SpaceSidebarToken::StateIcon, SpaceSidebarToken::Workspace], vec![SpaceSidebarToken::Branch, SpaceSidebarToken::GitStatus], ], + row_gap: DEFAULT_SIDEBAR_ROW_GAP, } } } @@ -268,6 +273,7 @@ mod tests { ] ); assert!(config.agents.rows_by_agent.is_empty()); + assert_eq!(config.agents.row_gap, 0); assert_eq!( config.spaces.rows, vec![ @@ -275,6 +281,7 @@ mod tests { vec![SpaceSidebarToken::Branch, SpaceSidebarToken::GitStatus], ] ); + assert_eq!(config.spaces.row_gap, 0); } #[test] @@ -283,12 +290,14 @@ mod tests { r#" [ui.sidebar.agents] rows = [["state_icon", "workspace"], ["state_text", "agent", "$summary"], ["terminal_title", "terminal_title_stripped", "$terminal_title"]] +row_gap = 1 [ui.sidebar.agents.rows_by_agent] claude = [["terminal_title_stripped"], ["agent", "$model"]] [ui.sidebar.spaces] rows = [["workspace"], ["$jj_status"]] +row_gap = 3 "#, ) .expect("sidebar token config"); @@ -319,10 +328,12 @@ rows = [["workspace"], ["$jj_status"]] ], ] ); + assert_eq!(config.ui.sidebar.agents.row_gap, 1); assert_eq!( config.ui.sidebar.spaces.rows[1], vec![SpaceSidebarToken::Custom("jj_status".into())] ); + assert_eq!(config.ui.sidebar.spaces.row_gap, 3); } #[test] |
