From b45364331dcf781663b4f70a2ceaa924ac04c278 Mon Sep 17 00:00:00 2001 From: TomZz Date: Tue, 16 Jun 2026 04:38:01 +0800 Subject: [PATCH] fix: restore full terminal width in split panes Use the outer terminal panel bounds for PTY resizing while keeping per-pane bounds for focus and input handling. This prevents split panes from being resized a second time to half width. --- src/app/mod.rs | 2 ++ src/app/ui.rs | 6 ++++++ src/session/mod.rs | 13 ++++--------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index 66086ea..5e7a839 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -238,6 +238,7 @@ pub(crate) struct Ashell { pub(crate) system_status: Option, pub(crate) pane_root: PaneLayout, pub(crate) focused_pane_path: Vec, + pub(crate) terminal_panel_bounds: Option>, pub(crate) terminal_bounds: HashMap>, pub(crate) terminal_selecting: bool, pub(crate) dragging_splitter: Option<(Vec, usize)>, // (parent_path, child_index) @@ -425,6 +426,7 @@ impl Ashell { active_group: None, pane_root: PaneLayout::Single(String::new()), focused_pane_path: Vec::new(), + terminal_panel_bounds: None, selector_selection: 0, workspace_panels, body_panels, diff --git a/src/app/ui.rs b/src/app/ui.rs index fb8493d..c24a6e7 100644 --- a/src/app/ui.rs +++ b/src/app/ui.rs @@ -1692,10 +1692,16 @@ impl Ashell { fn render_terminal_panel(&mut self, cx: &mut Context) -> impl IntoElement { let has_active = self.active_tab.is_some(); let pane_tree = self.pane_root.clone(); + let view = cx.entity(); v_flex().size_full().child( div() .size_full() + .on_prepaint(move |bounds, _window, cx| { + let _ = view.update(cx, |this, _| { + this.terminal_panel_bounds = Some(bounds); + }); + }) .overflow_hidden() .track_focus(&self.focus_handle) .key_context(TERMINAL_KEY_CONTEXT) diff --git a/src/session/mod.rs b/src/session/mod.rs index 4948d43..c491436 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -875,16 +875,11 @@ impl Ashell { .first() .map(|size| size.as_f32()) .unwrap_or(SIDEBAR_WIDTH); - let terminal_bounds = self - .active_tab - .as_ref() - .and_then(|tab_id| self.terminal_bounds.get(tab_id)); - // Prefer the measured terminal element bounds when we already have - // them. That keeps the PTY sized to the real visible content area, - // instead of relying on a conservative viewport heuristic that can - // leave several rows unused at the bottom. - let (width, height) = if let Some(bounds) = terminal_bounds { + // Use the whole terminal panel bounds for PTY sizing. + // Individual pane bounds are smaller when split, so using them here + // would shrink the root PTY dimensions a second time. + let (width, height) = if let Some(bounds) = self.terminal_panel_bounds { (bounds.size.width.as_f32(), bounds.size.height.as_f32()) } else { let terminal_height = self