[UI] Stop the stack preview overrunning a narrow terminal - #46
Merged
Conversation
This was referenced Jul 26, 2026
KCaverly
force-pushed
the
ct/diff_view/28d7958e
branch
from
July 26, 2026 19:23
3359abd to
6d2dd72
Compare
KCaverly
force-pushed
the
ct/diff_view/c99f90a2
branch
from
July 26, 2026 19:23
7b9e6c4 to
e98d9a2
Compare
KCaverly
force-pushed
the
ct/diff_view/28d7958e
branch
from
July 26, 2026 19:30
6d2dd72 to
2aebb3b
Compare
KCaverly
force-pushed
the
ct/diff_view/c99f90a2
branch
from
July 26, 2026 19:30
e98d9a2 to
9ab1218
Compare
KCaverly
force-pushed
the
ct/diff_view/28d7958e
branch
from
July 26, 2026 19:34
2aebb3b to
35296c1
Compare
KCaverly
force-pushed
the
ct/diff_view/c99f90a2
branch
from
July 26, 2026 19:34
9ab1218 to
f8e9baa
Compare
KCaverly
force-pushed
the
ct/diff_view/28d7958e
branch
from
July 26, 2026 19:39
35296c1 to
3157a90
Compare
KCaverly
force-pushed
the
ct/diff_view/c99f90a2
branch
from
July 26, 2026 19:39
f8e9baa to
819f3ae
Compare
v was the stack screen's second drill-in, and it was never really a drill-in: it tore the screen down, forced the deck back on, rewrote the active cursor and opened the deck's diff overlay. Reading one branch diff cost you your place in the stack, and the split preview advertised it in a footer where pressing it destroyed the split. The preview replaces what it was for, and the uncommitted row replaces the one thing the preview could not reach — the deck viewer's u scope toggle was the only way to read work in progress, and that now has a row of its own. The deck's own v is untouched. It stays the diff surface for worktrees the stack screen cannot open at all: the primary tree, a detached branch, or a worktree with no base to compare against. Also removed from the split fall-through list, so the key is inert rather than quietly reaching the shared switch, and from the help overlay's stack line — which had gone stale anyway, still listing v while never having mentioned d. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> ct-stack-id: 28d7958e
The split sized its two columns with independent clamps, so each could satisfy its own floor while their sum overran the terminal. At 30 columns it drew 37-column rows — every row wrapped, shearing the layout — and there was no width below which it declined to open at all. rightW is now derived from leftW rather than clamped separately, which is what makes the three parts sum to exactly m.width by construction instead of by arithmetic that happened to work at common sizes. Below 60 columns the two columns plus the divider cannot both carry useful content, so the screen falls back to the plain stack list. That covers the resize-down case for free: the split flag stays set and the preview returns when the terminal is widened again, with no keypress. splitShown is the one predicate the renderer, the key routing and the wheel all consult, so they cannot disagree about whether there is a pane on screen — keys driving an invisible pane would be the natural next bug here. Pressing d while too narrow flashes rather than silently doing nothing. The sweep test walks every width from minViableWidth to 200 and fails on any row wider than its terminal; it reproduces the original 37-in-24 break. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> ct-stack-id: c99f90a2
KCaverly
force-pushed
the
ct/diff_view/28d7958e
branch
from
July 26, 2026 19:41
3157a90 to
55823c9
Compare
KCaverly
force-pushed
the
ct/diff_view/c99f90a2
branch
from
July 26, 2026 19:41
819f3ae to
0e2b1e9
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.
The split sized its two columns with independent clamps, so each could
satisfy its own floor while their sum overran the terminal. At 30 columns it
drew 37-column rows — every row wrapped, shearing the layout — and there was
no width below which it declined to open at all.
rightW is now derived from leftW rather than clamped separately, which is
what makes the three parts sum to exactly m.width by construction instead of
by arithmetic that happened to work at common sizes.
Below 60 columns the two columns plus the divider cannot both carry useful
content, so the screen falls back to the plain stack list. That covers the
resize-down case for free: the split flag stays set and the preview returns
when the terminal is widened again, with no keypress. splitShown is the one
predicate the renderer, the key routing and the wheel all consult, so they
cannot disagree about whether there is a pane on screen — keys driving an
invisible pane would be the natural next bug here. Pressing d while too
narrow flashes rather than silently doing nothing.
The sweep test walks every width from minViableWidth to 200 and fails on any
row wider than its terminal; it reproduces the original 37-in-24 break.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Stack (bottom → top):