Skip to content

fix(prompts): measure spinner frame at current width when clearing - #645

Open
utsxvrai wants to merge 1 commit into
bombshell-dev:mainfrom
utsxvrai:fix/spinner-resize-columns
Open

utsxvrai wants to merge 1 commit into
bombshell-dev:mainfrom
utsxvrai:fix/spinner-resize-columns

Conversation

@utsxvrai

Copy link
Copy Markdown

What does this PR do?

spinner read the terminal width once, when it was created, and worked out how many lines to clear from the raw message only (without the ◒ frame prefix, dots or timer). So when the terminal got narrower while the spinner was running, or when the frame itself wrapped, it cleared too few lines and old frames stacked up on screen.

It now keeps the frame it last wrote and re-wraps it at the current width before clearing. Each new frame is also wrapped at the current width. This is the same approach Prompt.restoreCursor in core already uses. progress is built on spinner, so it gets the fix too.

Closes #132

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • pnpm test passes (or targeted tests for my change) — spinner tests pass (66/66; the 4 new ones fail without the fix); the 4 note.test.ts snapshot failures also happen on main locally
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

Note: open PR #584 also touches the spinner's wrapping code; this change is separate, but one of them may need a small rebase if both land. Tested with mocked output only, not in a real resizing terminal.

@changeset-bot

changeset-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24b0e1c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

[Bug] Spinner message is repeated infinitely if terminal window width is smaller than message width

1 participant