mirror of
https://github.com/rust-kotlin/ashell.git
synced 2026-09-22 16:00:59 +00:00
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.
This commit is contained in:
@@ -238,6 +238,7 @@ pub(crate) struct Ashell {
|
||||
pub(crate) system_status: Option<SharedString>,
|
||||
pub(crate) pane_root: PaneLayout,
|
||||
pub(crate) focused_pane_path: Vec<usize>,
|
||||
pub(crate) terminal_panel_bounds: Option<Bounds<Pixels>>,
|
||||
pub(crate) terminal_bounds: HashMap<String, Bounds<Pixels>>,
|
||||
pub(crate) terminal_selecting: bool,
|
||||
pub(crate) dragging_splitter: Option<(Vec<usize>, 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,
|
||||
|
||||
@@ -1692,10 +1692,16 @@ impl Ashell {
|
||||
fn render_terminal_panel(&mut self, cx: &mut Context<Self>) -> 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)
|
||||
|
||||
+4
-9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user