Skip to content

Scroll approval prompts when their body overflows the terminal - #291

Merged
TheGreatAxios merged 4 commits into
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-commandfrom
cl-4612-make-approval-prompts-scroll-when-content-overflows-the
Aug 4, 2026
Merged

Scroll approval prompts when their body overflows the terminal#291
TheGreatAxios merged 4 commits into
cl-4868-make-the-shell-approval-dialog-readable-no-duplicate-commandfrom
cl-4612-make-approval-prompts-scroll-when-content-overflows-the

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The permission modal's request body (segment list, expanded payloads, notice) now pages against the real terminal height instead of painting past it; the focused choice and full action list stay fixed and reachable below it, with PageUp/PageDown scrolling the body and a scroll indicator when truncated
  • The operator modal's question scrolls the same way, and a long option list windows around the current selection so the focused option always stays visible as the operator navigates
  • Short prompts render exactly as before, with no scroll indicator or forced affordance

Verification

  • bun run typecheck && bun run build && bun test — full suite passes (3586/3586)
  • New coverage: tests/unit/tui/permission-modal.test.tsx and tests/unit/tui/operator-modal.test.tsx (body/question taller than the viewport, PageUp/PageDown paging, option-list windowing, short-prompt no-scroll-affordance case)

Closes CL-4612

@linear-code

linear-code Bot commented Aug 1, 2026

Copy link
Copy Markdown

CL-4612

@TheGreatAxios
TheGreatAxios force-pushed the cl-4612-make-approval-prompts-scroll-when-content-overflows-the branch 2 times, most recently from 81296c7 to f9c1554 Compare August 2, 2026 04:09
@TheGreatAxios
TheGreatAxios force-pushed the cl-4612-make-approval-prompts-scroll-when-content-overflows-the branch 2 times, most recently from 5ff9729 to f78eced Compare August 2, 2026 04:49
@TheGreatAxios
TheGreatAxios force-pushed the cl-4612-make-approval-prompts-scroll-when-content-overflows-the branch from f78eced to 8c598f5 Compare August 4, 2026 00:12
The permission modal's request body (segment list, expanded payloads,
notice) and the operator modal's question and option list now page
against the real terminal height instead of painting past it. The
focused choice and full action list stay fixed and reachable below the
body; PageUp/PageDown scroll a long body or question, and a long option
list windows to keep the highlighted option in view as the operator
navigates. Short prompts render exactly as before, with no scroll
indicator or forced affordance.
The overflow indicator already shows "more below" while content
remains past the visible window and swaps to "more above" once
scrolled to the end, right next to the Accept/Reject choices. No
gap found, so this only covers the existing behavior with a test.
operator-modal and permission-modal each carried their own copy of
FALLBACK_TERMINAL_ROWS, maxRowOffset, and the clamp-and-slice
PageUp/PageDown logic. Extract it into useScrollWindow so the offset
math is owned in one place.
Clamp scroll offset before paging when content shrinks, reserve rows for
scroll indicators, keep PageUp/PageDown while typing a custom answer,
sanitize and clamp agent labels/cwds, expand non-collapsible multi-line
bodies, and hide Ctrl+O when nothing is expandable.
@TheGreatAxios
TheGreatAxios force-pushed the cl-4612-make-approval-prompts-scroll-when-content-overflows-the branch from 8c598f5 to 278b8bc Compare August 4, 2026 00:27
@TheGreatAxios
TheGreatAxios marked this pull request as ready for review August 4, 2026 03:17
@TheGreatAxios
TheGreatAxios merged commit 703037f into main Aug 4, 2026
1 check passed
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