From 15539d3dec40bcc40e6f4bb0eaa4f073ad26b74f Mon Sep 17 00:00:00 2001 From: Can Celik Date: Sat, 15 Aug 2026 15:09:53 +0300 Subject: feat: make headless terminal size configurable (#2829) refs #2828 --- src/app/state.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/app/state.rs') diff --git a/src/app/state.rs b/src/app/state.rs index ea550472..e03d90a9 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -1428,6 +1428,8 @@ pub struct AppState { // Config pub prefix_code: KeyCode, pub prefix_mods: KeyModifiers, + /// Virtual terminal size (columns, rows) used when no client is attached. + pub(crate) headless_size: (u16, u16), pub default_sidebar_width: u16, pub sidebar_width: u16, pub sidebar_min_width: u16, @@ -1618,7 +1620,7 @@ impl AppState { if let Some(info) = self.view.pane_infos.first() { (info.rect.height, info.rect.width) } else { - (24, 80) + (self.headless_size.1, self.headless_size.0) } } @@ -1800,6 +1802,10 @@ impl AppState { outer_terminal_focus: None, prefix_code: KeyCode::Char('b'), prefix_mods: KeyModifiers::CONTROL, + headless_size: ( + crate::config::DEFAULT_HEADLESS_COLS, + crate::config::DEFAULT_HEADLESS_ROWS, + ), default_sidebar_width: 26, sidebar_width: 26, sidebar_min_width: 18, @@ -2242,6 +2248,14 @@ mod tests { use super::*; use crossterm::event::KeyEvent; + #[test] + fn pane_size_estimate_uses_headless_size_before_first_view() { + let mut state = AppState::test_new(); + state.headless_size = (132, 41); + + assert_eq!(state.estimate_pane_size(), (41, 132)); + } + #[test] fn agent_terminal_keeps_final_child_cursor_exposed() { let mut state = AppState::test_new(); -- cgit v1.2.3