Skip to content

Commit

Permalink
fix text cancel display bug
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re committed Feb 17, 2023
1 parent 21546d7 commit 83d890e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-walls-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clack/prompts': patch
---

Fix text cancel display bug
4 changes: 2 additions & 2 deletions packages/prompts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export const text = (opts: TextOptions) => {
case 'submit':
return `${title}${color.gray(S_BAR)} ${color.dim(this.value || opts.placeholder)}`;
case 'cancel':
return `${title}${color.gray(S_BAR)} ${color.strikethrough(color.dim(this.value))}${
this.value.trim() ? '\n' + color.gray(S_BAR) : ''
return `${title}${color.gray(S_BAR)} ${color.strikethrough(color.dim(this.value ?? ''))}${
this.value?.trim() ? '\n' + color.gray(S_BAR) : ''
}`;
default:
return `${title}${color.cyan(S_BAR)} ${value}\n${color.cyan(S_BAR_END)}\n`;
Expand Down

0 comments on commit 83d890e

Please sign in to comment.