Skip to content

fix: bottom row clipped and input frozen when the tab bar appears#1552

Open
shiena wants to merge 3 commits intoraphamorim:mainfrom
shiena:fix/split-bottom-overflow-on-tab
Open

fix: bottom row clipped and input frozen when the tab bar appears#1552
shiena wants to merge 3 commits intoraphamorim:mainfrom
shiena:fix/split-bottom-overflow-on-tab

Conversation

@shiena
Copy link
Copy Markdown
Contributor

@shiena shiena commented Apr 23, 2026

Fixes #1495, #1528.

When navigation.hide_if_single = true (the default) and a second tab is opened, the tab bar appears and shifts the render origin down by the island height (~34 px).
Before this change, the terminal panels were still sized against the full window height, so the last row ended up drawn past the bottom of the visible window area.
With a horizontal split, the bottom pane's last row disappeared entirely.

A follow-up symptom showed up once the layout was corrected: after closing back to a single tab (via shell exit), keystrokes no longer produced any visible output until the window was clicked or a tab-switch shortcut forced a render. This turned out to be a pre-existing damage-routing bug that the layout fix surfaced.

Combined with #1518 this fully resolves #1495: this PR handles the "new tab → bottom clipped" direction and the stuck-input regression, while #1518 covers the "shell exit → top strip retained" direction.

@shiena shiena force-pushed the fix/split-bottom-overflow-on-tab branch from 6d69781 to 87eecf8 Compare April 25, 2026 16:57
@shiena
Copy link
Copy Markdown
Contributor Author

shiena commented Apr 25, 2026

Rebased only the minimum set of commits required to apply this PR onto the current main (97340fe).

@shiena shiena force-pushed the fix/split-bottom-overflow-on-tab branch 2 times, most recently from 66e9cb5 to 794e4b5 Compare April 26, 2026 14:24
@shiena shiena force-pushed the fix/split-bottom-overflow-on-tab branch 11 times, most recently from 1ed5c3b to e8e109f Compare May 3, 2026 08:25
shiena added 3 commits May 4, 2026 11:58
Tab bar appearing (e.g. new tab spawning the island) left Taffy's root
node sized against the old margin while rich_text positions shifted
down by the new margin, so the bottom row landed below the window.

Keep Taffy's root size in sync inside update_scaled_margin so panels
are reallocated to the new available area whenever apply_taffy_layout
runs next.
ContextManager::get_by_route_id only looked inside the current grid,
so TerminalDamaged events from background tabs were silently dropped.
The PTY side had already set damage_event_in_flight=true when sending
the event, and nothing ever reset it, so once the user switched back
to that tab its terminal could not emit further damage notifications
until something forced a full render (a click or a tab-switch
shortcut).

Search all grids instead. The dirty flag accumulates on the
background panel's renderable content, and when the user brings that
tab forward the renderer processes the pending damage and clears
in_flight on the next frame. The terminal buffer retains its damage
state in the meantime, so nothing is lost.

Surfaced by 1-tab to 2-tab to 1-tab transitions where the tab-bar
margin change actually resized the background terminal and made its
shell emit data while it was in the background.
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.
@shiena shiena force-pushed the fix/split-bottom-overflow-on-tab branch from e8e109f to 04c637c Compare May 4, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

on opening new tab the bottom of the terminal is hidden until window resize

1 participant