Skip to content

fix: respect the prompt output stream width - #630

Merged
43081j merged 1 commit into
bombshell-dev:mainfrom
imharjot:fix/respect-prompt-output-width
Oct 29, 2026
Merged

43081j merged 1 commit into
bombshell-dev:mainfrom
imharjot:fix/respect-prompt-output-width

Conversation

@imharjot

@imharjot imharjot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fix prompt wrapping and clearing when the prompt is written to a different output stream from stdout.

For example, text({ output: process.stderr, ... }) on a 40-column terminal leaves part of the previous question on screen when stdout is piped. The prompt currently measures both frames against process.stdout.columns, even though it writes to stderr. Using getColumns(this.output) in both places keeps rendering and cursor restoration consistent with the stream receiving the prompt.

The two regression cases fail before the fix. I also checked the built prompt in a real 40-column PTY with stdout piped: typing abc and cancelling leaves two copies of the question before this change and one afterwards. The narrow-output snapshots now include wrapped help text and its extra cursor row.

There is no linked issue for this specific case; this is a small correction to the existing custom-output option. It does not attempt to fix terminal resizing in general.

Type of change

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

Validation

With Node 24.22.1 and pnpm 10.33.0, pnpm test passes: 173 core tests and 628 prompts tests, with 4 existing skips. pnpm format, pnpm lint, pnpm types, and pnpm deps pass.

I also ran the full suite on the pinned Node 20.18.1. It has four note.test.ts color snapshot failures; a separate checkout of unchanged main produces the same four failures. Both new regressions pass on Node 20, and no note snapshots were changed.

GitHub's build, types, tests, dependency checks, and preview also pass. The separate Detect Agent workflow fails during npm install --prefix automation with Cannot read properties of null (reading 'edgesOut'), before it runs detection.

Checklist

  • pnpm test passes (or targeted tests for my change)
  • 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

@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e20263f

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

This PR includes changesets to release 2 packages
Name Type
@clack/core Patch
@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

@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026

Copy link
Copy Markdown

commit: e20263f

@43081j
43081j merged commit e66ab12 into bombshell-dev:main Oct 29, 2026
10 of 11 checks passed
@bombshell-bot bombshell-bot Bot mentioned this pull request Oct 29, 2026
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