Skip to content

Commit 1ed5c3b

Browse files
committed
fix: seed new tab grid with window size, not panel size
add_context fed current.dimension straight into ContextGrid::new for single-panel tabs. After apply_taffy_layout has run on the old tab, that dimension carries panel-sized width/height (= window − scaled margin) with margin zeroed. ContextGrid::new then stored those panel dimensions as self.width/self.height — its idea of the window size — and try_update_size subtracted the margin a second time on every later call. The break only surfaced once update_scaled_margin started syncing Taffy's root via try_update_size: closing the original tab so the freshly-spawned tab survived made resize_top_or_bottom_line(1) ask Taffy for window_h − 34 − 2 instead of window_h − 2, leaving a tab- bar-sized gap at the bottom after hide_if_single hid the strip. Closing the new tab and keeping the original masked it because the original grid was built with window dimensions at Screen::new and nothing rewrites self.width/self.height afterwards. Always rebuild the dimension from the current grid via grid_dimension(), which composes self.width/self.height (window size) with the unscaled margin. The split-only branch becomes redundant since grid_dimension() already produces the correct value for both single-panel and multi-panel grids.
1 parent 033f55f commit 1ed5c3b

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

  • frontends/rioterm/src/context

frontends/rioterm/src/context/mod.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,15 +1098,20 @@ impl<T: EventListener + Clone + std::marker::Send + 'static> ContextManager<T> {
10981098

10991099
let current = self.current();
11001100
let cursor = current.cursor_from_ref();
1101-
let mut dimension = current.dimension;
1102-
1103-
// If current has splits then shouldn't use that dimension
1104-
if self.current_grid().len() > 1 {
1105-
dimension = self.current_grid().grid_dimension();
1106-
}
1101+
let has_blinking_enabled = current.renderable_content.has_blinking_enabled;
1102+
1103+
// Always rebuild from the grid: current.dimension can hold a
1104+
// panel-sized value (margin=0, width/height = window − margin)
1105+
// after apply_taffy_layout has run on the old tab. Feeding that
1106+
// to ContextGrid::new would have it subtract the margin a second
1107+
// time and store a too-small self.width/self.height, so the next
1108+
// hide_if_single transition (e.g. closing back to one tab) sizes
1109+
// the surviving panel for window − 2·margin and leaves a tab-bar-
1110+
// sized gap at the bottom.
1111+
let dimension = self.current_grid().grid_dimension();
11071112

11081113
match ContextManager::create_context(
1109-
(&cursor, current.renderable_content.has_blinking_enabled),
1114+
(&cursor, has_blinking_enabled),
11101115
self.event_proxy.clone(),
11111116
self.window_id,
11121117
rich_text_id,

0 commit comments

Comments
 (0)