Skip to content

fix(prompts): preserve the guide on multiline messages - #657

Open
clean99 wants to merge 1 commit into
bombshell-dev:mainfrom
clean99:contrib/prompt-message-newline-spacing
Open

clean99 wants to merge 1 commit into
bombshell-dev:mainfrom
clean99:contrib/prompt-message-newline-spacing

Conversation

@clean99

@clean99 clean99 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Messages containing newlines lose their continuation-line guide in text, password, date, multiline, selectKey, and groupMultiselect.

  • Problem: text({ message: 'foo\nbar\nbaz' }) puts bar and baz at the left edge, unlike confirm after fix: correctly wrap multi-line messages in confirm prompt #495.
  • Change: use the existing wrapTextWithPrefix helper for these six message titles, respecting the output width and withGuide. Single-line messages that fit remain unchanged.
  • Verification: pnpm --filter @clack/prompts test test/message.test.ts checks initial, submitted, and cancelled output with and without the guide. The guided cases fail before the fix. Workspace tests, build, types, dependency checks, lint, and format pass on Node 22.23.5.

Refs #306. Autocomplete wrapping remains with #634.

At base commit 9ab99de, after pnpm install && pnpm build, run from the repository root:

node --input-type=module -e "import { text } from './packages/prompts/dist/index.mjs'; await text({ message: 'foo\nbar\nbaz' });"

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)
  • 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

@pkg-pr-new

pkg-pr-new Bot commented Dec 3, 2026

Copy link
Copy Markdown

commit: 364f1bb

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