Reflow terminal panes when a sibling is spawned#189
Open
luckeyfaraday wants to merge 1 commit into
Open
Conversation
A pane's native `resize: vertical` handle writes an inline height directly onto the DOM node. React never manages that property, so it is never cleared, which left a previously resized pane pinned at its old height when a new pane was spawned below it — the pane above refused to shrink and the new pane rendered into a stale layout. Clear the inline height on every visible pane whenever the pane set changes, so the grid re-tiles all of them (which also fires each pane's ResizeObserver and refits its xterm). Switch the non-focused embedded stage to an equal share-space grid (minmax(0, 1fr) + stretch, min-height 0) so panes actually shrink to make room instead of scrolling. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Spawning a terminal pane below an existing one didn't shrink the pane above — the new pane rendered into a stale, half-garbled layout. It only happened after a pane had been manually resized.
Root cause
Each pane exposes a native drag-resize handle (
.slotPane { resize: vertical }). When you drag it, the browser writes an inlineheight:straight onto the DOM node. React never sets that property, so it never clears it on re-render — the resized pane stays pinned at its old height and won't participate in the grid when a sibling is added. Un-resized panes have no inline height, so they reflow fine (hence "only sometimes").Fix
CommandRoom.tsx— clear the inlineheighton every visible pane whenever the pane set changes (spawn / close / reorder), so the grid re-tiles all of them. Because each pane's box then actually changes size, its existingResizeObserverfires and refits the xterm, clearing the stale render too.styles.css— switch the non-focused embedded stage to an equal share-space grid (grid-auto-rows: minmax(0, 1fr)+align-content: stretch,.slotPanemin-height: 0) so panes shrink to make room instead of the stage just scrolling.Behavior / trade-off
Manual vertical resize still works within a stable set of panes; it's just no longer sticky across spawn/close — adding or removing a pane snaps everyone back to equal tiling.
overflow: autois kept so a deliberately tall pane scrolls rather than clips.Testing
tsc -p tsconfig.json --noEmitpasses.🤖 Generated with Claude Code