fix(tabs): recompute grid rows when the tab strip toggles#1699
Closed
cmoron wants to merge 1 commit into
Closed
Conversation
Opening the second tab (or closing back to one) shows/hides the tab strip, which changes the terminal's top margin. `resize_top_or_bottom_line` updated the grid's `scaled_margin` — the render offset — but never resized the Taffy root node, so the panel kept its full-window height and the row count (PTY lines) stayed unchanged. The content simply shifted down by the strip height while keeping the same number of rows, pushing the bottom rows (shell prompt, bottom of vim) off-window. It only self-corrected on the next window resize, which is the one path that runs `try_update_size`. Re-run the same per-grid resize the window-resize path already uses (`try_update_size` + `apply_taffy_layout`) after updating the margin, so the root shrinks by the new margin and the line count is recomputed and pushed to the PTY.
Author
|
Closing as a duplicate. This is #1495, already addressed by #1632 (fixes at |
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.
Summary
Opening a second tab (or closing back to a single tab) shows/hides the tab strip, which changes the terminal's top margin. The grid's row count was not recomputed, so the bottom rows overflowed off-window until the next window resize.
Reproduction
Tabnavigation (tab strip hidden while there is a single tab).seq 1 200, or openvim).Reproduced on
main(2bb89d2); the report was cross-platform.Root cause
ContextGridrepresents the margin twice, and both must stay in sync:scaled_margin— the render offset (origin_y = panel_rect.y + scaled_margin.top).lines, the PTY winsize), is derived. It is set bytry_update_size, which subtractsscaled_margin.ContextGrid::resize()(the window-resize path) updates both. Butresize_top_or_bottom_line— the tab-strip toggle path — calledupdate_scaled_margin()(which sets only the field) followed byresize_all_contexts()(which resends the existing, now-staledimension). The Taffy root was never resized, solinesstayed at the full-height value: the content shifted down without dropping any rows, and only the next window resize (the one path that runstry_update_size) corrected it.Fix
After updating the margin, re-run the same per-grid resize the window-resize path already uses (
try_update_size+apply_taffy_layout), so the root shrinks by the new margin and the row count is recomputed and pushed to the PTY. This covers both directions: the strip appearing (1 → 2 tabs) and disappearing (2 → 1).Testing
cargo test -p rioterm— 147/147 pass.