fix: fix note component overflow bug#376
Conversation
…ix note component overflow bug
🦋 Changeset detectedLatest commit: 8e68b31 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
@example/basic • @example/changesets commit: |
|
Wait, i have a problem... |
|
Ok, done |
|
Hello everyone, this is good? import { note } from "@clack/prompts";
import color from "picocolors";
const longText = "Incididunt dolor sunt aliqua minim labore tempor ea ea esse aliquip. Laborum ipsum qui velit duis ullamco minim amet eu amet dolore. Eiusmod fugiat quis laboris id occaecat velit anim laboris ullamco exercitation sint est.";
await note(longText, "title", {
format: (line) => color.dim(`* ${line} *`)
}); |
dreyfus92
left a comment
There was a problem hiding this comment.
Thank you for working on this, LGTM 🤘🏻
|
@43081j, can you merge this? |
packages/prompts/src/note.ts
Outdated
| const format = opts?.format ?? defaultNoteFormatter; | ||
| const wrapMsg = wrapWithFormat(message, output.columns - 6, format); | ||
| const lines = ['', ...wrapMsg.split('\n').map(format), '']; | ||
| const titleLen = strip(title).length; |
There was a problem hiding this comment.
the thing that makes this harder to review is stuff like this where the consts have been reordered unnecessarily
for future reference, diffs should be as concise as possible to make for easy reviewing. so its a good idea to avoid doing this
similarly, the reduce change further down doesn't improve anything, it does the same job a different way and adds to the diff
|
Sorry it's taken me so long to review this I'll get to it this weekend if I can 👍 |
|
@43081j, i have do minimal changes. Can you review it? |
43081j
left a comment
There was a problem hiding this comment.
this looks good to me. thanks so much for simplifying the diff too

In this PR, i fix
notecomponent overflow bug when use long text. This meannotecomponent will wrap your text based on your terminal width.Before:

After:
