Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cruel-hairs-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clack/prompts": patch
---

Fix spinner clearing too many lines upwards when non-wrapping.
4 changes: 3 additions & 1 deletion packages/prompts/src/spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ export const spinner = ({
trim: false,
});
const prevLines = wrapped.split('\n');
output.write(cursor.up(prevLines.length - 1));
if (prevLines.length > 1) {
output.write(cursor.up(prevLines.length - 1));
}
output.write(cursor.to(0));
output.write(erase.down());
};
Expand Down
33 changes: 0 additions & 33 deletions packages/prompts/test/__snapshots__/progress-bar.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ exports[`prompts - progress (isCI = false) > message > sets message for next fra
"│
",
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ foo",
Expand Down Expand Up @@ -96,15 +95,12 @@ exports[`prompts - progress (isCI = false) > start > renders frames at interval
"│
",
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◓ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◑ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
Expand Down Expand Up @@ -135,7 +131,6 @@ exports[`prompts - progress (isCI = false) > stop > renders cancel symbol if cod
"│
",
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"■
Expand All @@ -150,7 +145,6 @@ exports[`prompts - progress (isCI = false) > stop > renders error symbol if code
"│
",
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"▲
Expand All @@ -165,7 +159,6 @@ exports[`prompts - progress (isCI = false) > stop > renders message 1`] = `
"│
",
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇ foo
Expand All @@ -180,7 +173,6 @@ exports[`prompts - progress (isCI = false) > stop > renders message without remo
"│
",
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇ foo.
Expand All @@ -195,7 +187,6 @@ exports[`prompts - progress (isCI = false) > stop > renders submit symbol and st
"│
",
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand All @@ -210,19 +201,15 @@ exports[`prompts - progress (isCI = false) > style > renders block progressbar 1
"│
",
"◒ ██████████ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ██████████ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◓ ██████████ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◑ ██████████ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand All @@ -237,19 +224,15 @@ exports[`prompts - progress (isCI = false) > style > renders heavy progressbar 1
"│
",
"◒ ━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◓ ━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◑ ━━━━━━━━━━ ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand All @@ -264,19 +247,15 @@ exports[`prompts - progress (isCI = false) > style > renders light progressbar 1
"│
",
"◒ ────────── ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ────────── ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◓ ────────── ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◑ ────────── ",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand All @@ -293,7 +272,6 @@ exports[`prompts - progress (isCI = true) > message > sets message for next fram
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ foo...",
Expand Down Expand Up @@ -412,7 +390,6 @@ exports[`prompts - progress (isCI = true) > stop > renders cancel symbol if code
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"■
Expand All @@ -429,7 +406,6 @@ exports[`prompts - progress (isCI = true) > stop > renders error symbol if code
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"▲
Expand All @@ -446,7 +422,6 @@ exports[`prompts - progress (isCI = true) > stop > renders message 1`] = `
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇ foo
Expand All @@ -463,7 +438,6 @@ exports[`prompts - progress (isCI = true) > stop > renders message without remov
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇ foo.
Expand All @@ -480,7 +454,6 @@ exports[`prompts - progress (isCI = true) > stop > renders submit symbol and sto
"◒ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand All @@ -497,13 +470,11 @@ exports[`prompts - progress (isCI = true) > style > renders block progressbar 1`
"◒ ██████████ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ██████████ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand All @@ -520,13 +491,11 @@ exports[`prompts - progress (isCI = true) > style > renders heavy progressbar 1`
"◒ ━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ━━━━━━━━━━ ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand All @@ -543,13 +512,11 @@ exports[`prompts - progress (isCI = true) > style > renders light progressbar 1`
"◒ ────────── ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◐ ────────── ...",
"
",
"<cursor.up count=0>",
"<cursor.left count=1>",
"<erase.down>",
"◇
Expand Down
Loading