fix: viewport scrolling in bumpy add prompt#99
Merged
Conversation
The interactive bump-select prompt rendered all packages at once and used cursor-up to clear the previous frame on each keypress. When the list exceeded terminal height, lines scrolled off-screen and the cursor-up lost its anchor — causing the focus to snap to the bottom when navigating or interacting. Render a viewport that fits within the terminal: window the row list, adjust scroll to keep the focused row visible, show ▲/▼ "N more" indicators, and pin a sticky section header once the natural Changed or Unchanged header scrolls out of view. Re-renders on SIGWINCH. Closes #96.
|
The changes in this PR will be included in the next version bump.
|
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.


Summary
Fix #96 —
bumpy addsnapped focus to the bottom when navigating a package list taller than the terminal.The interactive bump-select prompt rendered every package at once and used
\x1B[NA(cursor up) to clear the previous frame before each re-render. Once the rendered output exceeded terminal height, earlier lines had scrolled off-screen and the cursor-up no longer reached the original anchor — so subsequent frames drew at the wrong position.Approach — windowed viewport rendering:
Changedheader → changed items → separator →Unchangedheader → unchanged items) with adisplayIdx → rowIdxmapstdout.rowsminus fixed chrome (header + footer)scrolloffset that adjusts to keep the focused row inside the window▲ N more/▼ N moreindicators when content is hidden above/belowChangedorUnchangedheader scrolls out of view, so the user always knows which section they're inSIGWINCHso resizing reflows the viewportTotal rendered output is now bounded by terminal height, so the cursor-up redraw always works.
Test plan
bun run check(lint + format + typecheck)bun run test(258 tests passing)←/→from a scrolled position does not snap focus to terminal bottom▲ N more/▼ N moreindicators appear correctlyUnchangedheader pins once the natural header scrolls off