Skip to content

Fix overlay clipping for long prompts#19

Open
sayeaud wants to merge 1 commit into
edlsh:mainfrom
sayeaud:fix-terminal-clipping
Open

Fix overlay clipping for long prompts#19
sayeaud wants to merge 1 commit into
edlsh:mainfrom
sayeaud:fix-terminal-clipping

Conversation

@sayeaud

@sayeaud sayeaud commented May 29, 2026

Copy link
Copy Markdown

Summary

  • Replace whole-overlay clipping with a terminal-height-aware layout that splits the dialog into:
    • a bounded, scrollable question/context prompt pane
    • a sticky answer/input area
    • sticky help/footer rows
  • Keep the prompt pane initially scrolled to the top so long questions are readable from the beginning.
  • Add prompt-pane scrolling shortcuts in overlay mode: PageUp / PageDown, plus Home / End and Ctrl+u / Ctrl+d while in select mode.
  • Add overflow indicators (, , ) so users can tell when hidden prompt text exists above or below.
  • Prioritize the editor region in freeform/comment modes so wrapped custom responses show multiple visible rows instead of being clipped to the first row.
  • Preserve inline mode behavior: inline rendering remains unbounded and uses normal transcript flow.

Why

The first terminal-height fix kept the answer rows and help/footer visible, but for very long questions/context it could center the viewport around the controls and clip the beginning of the prompt. Falling back to inline mode was also not sufficient because Pi inline custom UI is still an active TUI component, so terminal scrollback is not reliable while the prompt is open.

This update keeps the modal overlay but gives the prompt itself its own bounded scroll area. That lets users read the prompt from the top, scroll through long content, and still see/select answers without hiding the dialog. When the user switches to a custom response or comment editor, the layout shifts height toward the editor so long wrapped input remains readable.

Screenshots

Before

Before: long ask_user prompt clipped in the terminal overlay

After

After: scrollable prompt pane with sticky answer choices and help/footer

Validation

  • bun test
  • npm run check
  • Manual visual test in Pi with oversized ask_user prompts, including long question text and long context text.

@sayeaud

sayeaud commented Jun 3, 2026

Copy link
Copy Markdown
Author

Updated this PR with the follow-up fix from local testing.

The new approach keeps the overlay modal, but splits it into a bounded scrollable question/context pane plus sticky answers and sticky help/footer rows. This avoids both failure modes we saw: answer rows being pushed off-screen, and the top of long prompts being clipped. Overlay prompt scrolling is handled with PageUp / PageDown (Home / End and Ctrl+u / Ctrl+d in select mode), with overflow indicators for hidden prompt text.

I also refreshed the PR description with before/after screenshots and validation details.

Disclosure: I'm a developer - but not a TypeScript developer.

@sayeaud sayeaud force-pushed the fix-terminal-clipping branch from dbb46c4 to 78c4eac Compare June 3, 2026 20:31
@sayeaud sayeaud force-pushed the fix-terminal-clipping branch from 78c4eac to c23eb54 Compare June 4, 2026 20:27
@sayeaud

sayeaud commented Jun 4, 2026

Copy link
Copy Markdown
Author

Added another follow-up for custom/freeform responses: in overlay editor modes, the layout now prioritizes height for the editor area and caps the editor viewport in a way that preserves multiple wrapped input rows near the cursor. This addresses the case where a long custom response wrapped but only the first row was visible in the constrained overlay.

Validation: bun test (59 pass) and npm run check.

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.

2 participants