Skip to content

[UI] Stop the stack preview overrunning a narrow terminal - #46

Merged
KCaverly merged 2 commits into
mainfrom
ct/diff_view/c99f90a2
Jul 26, 2026
Merged

[UI] Stop the stack preview overrunning a narrow terminal#46
KCaverly merged 2 commits into
mainfrom
ct/diff_view/c99f90a2

Conversation

@KCaverly

@KCaverly KCaverly commented Jul 26, 2026

Copy link
Copy Markdown
Owner

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):

  1. [UI] Drop the branch-diff jump from the stack screen #45
  2. [UI] Stop the stack preview overrunning a narrow terminal #46 ← this PR
  3. [Git] Pin the diff flags the body parser depends on #47
  4. [UI] Teach both diff viewers the same file-jump key #48
  5. [Diff] Thread the [diff] config through the viewer and zoom with z #49
  6. [Git] Carry diff args and excludes through every diff call #50
  7. [Diff] Add the external diff pager package #51
  8. [Config] Accept a [diff] section with an optional pager #52
  9. [Docs] Document the diff viewer settings #53

@KCaverly
KCaverly force-pushed the ct/diff_view/28d7958e branch from 3359abd to 6d2dd72 Compare July 26, 2026 19:23
@KCaverly
KCaverly force-pushed the ct/diff_view/c99f90a2 branch from 7b9e6c4 to e98d9a2 Compare July 26, 2026 19:23
@KCaverly
KCaverly force-pushed the ct/diff_view/28d7958e branch from 6d2dd72 to 2aebb3b Compare July 26, 2026 19:30
@KCaverly
KCaverly force-pushed the ct/diff_view/c99f90a2 branch from e98d9a2 to 9ab1218 Compare July 26, 2026 19:30
@KCaverly
KCaverly force-pushed the ct/diff_view/28d7958e branch from 2aebb3b to 35296c1 Compare July 26, 2026 19:34
@KCaverly
KCaverly force-pushed the ct/diff_view/c99f90a2 branch from 9ab1218 to f8e9baa Compare July 26, 2026 19:34
@KCaverly
KCaverly force-pushed the ct/diff_view/28d7958e branch from 35296c1 to 3157a90 Compare July 26, 2026 19:39
@KCaverly
KCaverly force-pushed the ct/diff_view/c99f90a2 branch from f8e9baa to 819f3ae Compare July 26, 2026 19:39
KCaverly and others added 2 commits July 26, 2026 15:41
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
KCaverly force-pushed the ct/diff_view/28d7958e branch from 3157a90 to 55823c9 Compare July 26, 2026 19:41
@KCaverly
KCaverly force-pushed the ct/diff_view/c99f90a2 branch from 819f3ae to 0e2b1e9 Compare July 26, 2026 19:41
Base automatically changed from ct/diff_view/28d7958e to main July 26, 2026 19:42
@KCaverly
KCaverly merged commit 08ae78e into main Jul 26, 2026
2 checks passed
@KCaverly
KCaverly deleted the ct/diff_view/c99f90a2 branch July 26, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant