Skip to content

fix(multiselect): clear wrapped rows when redrawing - #192

Merged
jdx merged 1 commit into
mainfrom
agent/fix-multiselect-wrapped-redraw
Jul 26, 2026
Merged

fix(multiselect): clear wrapped rows when redrawing#192
jdx merged 1 commit into
mainfrom
agent/fix-multiselect-wrapped-redraw

Conversation

@jdx

@jdx jdx commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace MultiSelect's logical-line repositioning with physical-row-aware clear-and-redraw behavior
  • reuse the shared rendered_height calculation introduced for the other prompt widgets
  • add VT100 regression coverage for wrapped options, shrinking wrapped frames, and the existing no-drift behavior
  • centralize Unix TTY newline replay so terminal tests model ONLCR consistently

Root cause

MultiSelect counted output.lines() and repositioned/cleared one row per logical line. When an option or help footer exceeded the terminal width, it occupied multiple physical rows. Subsequent keypresses left those extra rows behind and drew the next frame below them, stacking repeated copies of the prompt.

This is the MultiSelect counterpart to #190, which deliberately left this widget for a follow-up because its line-by-line redraw path needed separate handling. It was reported through jdx/mise discussion #11326 in mise up --interactive.

User impact

Interactive multi-select prompts remain stable in narrow terminals and with long option labels. Filtering or otherwise shrinking the frame also clears rows previously occupied by wrapped content.

Validation

  • cargo fmt --check
  • cargo test --lib (41 passed)
  • cargo clippy --all-targets -- -D warnings

This PR was generated by an AI coding assistant.


Note

Low Risk
Terminal UI redraw logic only; behavior aligns with existing Select/height helpers and is covered by vt100 regression tests.

Overview
MultiSelect no longer redraws by moving the cursor up one row per logical line. Each keypress now clears the previous frame using physical terminal height (via shared rendered_height), then writes the new output—matching Select and fixing stacked duplicate prompts when options wrap in narrow terminals.

The old reposition_and_write path and last_line_count tracking are removed in favor of redraw + height. Unix terminal tests use a shared replay helper so vt100 replay applies ONLCR (\n\r\n), and regression coverage adds wrapped-option and shrinking-frame cases for MultiSelect.

Reviewed by Cursor Bugbot for commit 19c0848. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jdx, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: f91e735b-e5d6-492e-b72a-2eb3c991461e

📥 Commits

Reviewing files that changed from the base of the PR and between cc9092e and 19c0848.

📒 Files selected for processing (3)
  • src/multiselect.rs
  • src/select.rs
  • src/test.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

This PR makes MultiSelect redraws account for physical terminal rows.

  • Replaces logical-line repositioning with clear-and-redraw behavior using the shared rendered-height calculation.
  • Adds VT100 regression coverage for wrapped options, shrinking frames, and cursor stability.
  • Centralizes Unix TTY newline replay for terminal-emulation tests.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable defects identified in the changed redraw or test-helper behavior.

MultiSelect now clears the previously measured physical frame before rendering, matching sibling widget behavior, while the shared replay helper preserves the existing Unix TTY newline model.

Important Files Changed

Filename Overview
src/multiselect.rs Adopts the established physical-row-aware redraw pattern and adds focused regression coverage without an identified defect.
src/select.rs Replaces inline ONLCR emulation in a test with the equivalent shared replay helper.
src/test.rs Adds a Unix-only terminal replay helper that consistently translates captured LF output to CRLF for VT100 tests.

Reviews (1): Last reviewed commit: "fix(multiselect): clear wrapped rows whe..." | Re-trigger Greptile

@jdx
jdx merged commit 8608fe9 into main Jul 26, 2026
8 checks passed
@jdx
jdx deleted the agent/fix-multiselect-wrapped-redraw branch July 26, 2026 18:29
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