-
Notifications
You must be signed in to change notification settings - Fork 144
fix: fix note component overflow bug #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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} *`)
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me. thanks so much for simplifying the diff too
In this PR, i fix
note
component overflow bug when use long text. This meannote
component will wrap your text based on your terminal width.Before:

After:
