diff options
Diffstat (limited to 'src/app/state.rs')
| -rw-r--r-- | src/app/state.rs | 16 |
1 files changed, 15 insertions, 1 deletions
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, @@ -2243,6 +2249,14 @@ mod tests { 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(); let ws = crate::workspace::Workspace::test_new("test"); |
