Skip to content

feat(@clack/core,@clack/prompts): Multiline text input#240

Merged
dreyfus92 merged 16 commits intobombshell-dev:mainfrom
MacFJA:multiline
Apr 1, 2026
Merged

feat(@clack/core,@clack/prompts): Multiline text input#240
dreyfus92 merged 16 commits intobombshell-dev:mainfrom
MacFJA:multiline

Conversation

@MacFJA
Copy link
Copy Markdown
Contributor

@MacFJA MacFJA commented Feb 27, 2025

Add a new prompt: MultiLinePrompt and its rendering multiline

Changes

Added to @clack/core

  • Option to change the key that submit a prompt (default value is return to keep retro-compatibility)
  • A new event that send the raw char and key
  • A new util function (isSameKey) to test if two key are the same (with ctrl, meta, shift included in the check)
  • A new prompt MultiLinePrompt

Added to @clack/prompts

  • A new prompt function multiline

Difficulties and workaround

Issue: The return key is used to submit the prompt and is hardcoded, so impossible to insert new line
Solution: Make the submit key configurable (see: packages/core/src/prompts/prompt.ts:{22,53,210})

Issue: The default cursor management use vim mapping, so when pressing letter k, j, h or l to add those letter, the cursor also moves.
Solution: Re-implementing of the cursor management without vim mapping (see packages/core/src/prompts/multi-line.ts:29)

Issue: The event key lower the inputted char, so uppercased char are never displayed
Solution: Create a new event rawKey to send the untouched value (also used for the cursor management)


  • This PR (except if I miss something) don't create incompatibility with existing usage of the library (as it add new feature, and core changes have default value that behave as it was before)
  • This PR fix the issue [Feature Request] Multiline text #25

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 27, 2025

🦋 Changeset detected

Latest commit: 61486ae

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

This PR includes changesets to release 2 packages
Name Type
@clack/prompts Minor
@clack/core Minor

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
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 18, 2025

commit: 61486ae

@natemoo-re natemoo-re self-requested a review March 18, 2025 14:42
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow great stuff, thank you for contributing!

@deadcoder0904
Copy link
Copy Markdown

I'd love if this is merged. Its annoying to do multi-line with such a beautiful library. Only thing missing imo.

@43081j 43081j requested a review from dreyfus92 April 1, 2026 14:01
Copy link
Copy Markdown
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good @43081j, can you push a changeset?

@dreyfus92
Copy link
Copy Markdown
Member

thank you @43081j 🎉

@dreyfus92 dreyfus92 merged commit 814ab9a into bombshell-dev:main Apr 1, 2026
7 checks passed
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.

6 participants