fix: refresh Taffy root size when scaled margin changes#1632
Conversation
When a second tab is created and the tab bar transitions from hidden to visible, `update_scaled_margin` updated only the stored margin — Taffy's root size still reflected the old, larger available area. The subsequent layout pass then kept the panel at its old height and the PTY was never reflowed, so the bottom rows ended up clipped behind the freshly appeared tab bar. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> (cherry picked from commit 8cd7ea6)
329e201 to
c8e4324
Compare
|
Independently hit this (as #1495) and diagnosed the same root cause: the terminal margin is tracked in two places that must stay in sync — the Fixing at the setter is the right call — every |
Adopte la PR upstream raphamorim#1632 (nikicat) : update_scaled_margin ne mettait à jour que la marge stockée, laissant le root Taffy sur l'ancienne aire dispo. Le hot-reload de conf recalculait alors les lignes contre un root périmé (rows fausses jusqu'au prochain resize fenêtre). Complète ee589ea, qui ne couvrait que le chemin resize_top_or_bottom_line (toggle barre d'onglets / barre de recherche). À dropper quand raphamorim#1632 est mergé upstream.
close_tab lisait ctx().len() *après* que close_current_context ait déjà retiré le contexte, puis re-soustrayait 1 — donc fermer de 3 à 2 onglets passait num_tabs=1 à resize_top_or_bottom_line. Sur Linux/Windows ça prend la branche hide_if_single et retire la bande ISLAND_HEIGHT de la marge top : la grille garde ~2 lignes de trop (débordent hors fenêtre). On passe le vrai compte restant, comme tous les autres appelants. Bug latent aussi upstream ; ne se réveille qu'une fois le recompute des lignes actif (ee589ea / raphamorim#1632). Inerte sur macOS (branche num_tabs compilée hors binaire).
Summary
Fixes #1495 — on opening a new tab the bottom of the terminal is hidden until the
window is resized.
Details
When a second tab is created and the tab bar transitions from hidden to visible,
update_scaled_marginupdated only the stored margin — Taffy's root size stillreflected the old, larger available area. The subsequent layout pass then kept the
panel at its old height and the PTY was never reflowed, so the bottom rows ended up
clipped behind the freshly appeared tab bar.
update_scaled_marginnow refreshesthe Taffy root size so the next layout pass uses the correct available area.
Testing
cargo test -p rioterm— adds a regression test asserting the panel height shrinksby the new top margin after
update_scaled_margin.Closes #1495
🤖 Generated with Claude Code