fix: bottom row clipped and input frozen when the tab bar appears#1552
Open
shiena wants to merge 3 commits intoraphamorim:mainfrom
Open
fix: bottom row clipped and input frozen when the tab bar appears#1552shiena wants to merge 3 commits intoraphamorim:mainfrom
shiena wants to merge 3 commits intoraphamorim:mainfrom
Conversation
6d69781 to
87eecf8
Compare
Contributor
Author
|
Rebased only the minimum set of commits required to apply this PR onto the current main (97340fe). |
66e9cb5 to
794e4b5
Compare
1ed5c3b to
e8e109f
Compare
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.
e8e109f to
04c637c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.