Skip to content
Open
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/smooth-turtles-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clack/prompts': patch
---

Fix terminal cursor line-tracking offsets in MultiSelectPrompt to prevent option text from visually overwriting itself on smaller displays.
4 changes: 2 additions & 2 deletions packages/prompts/src/multi-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {
)
.join('\n');
// Calculate rowPadding: title lines + footer lines (error message + trailing newline)
const titleLineCount = title.split('\n').length;
const titleLineCount = title.split('\n').length - 1;
const footerLineCount = footer.split('\n').length + 1; // footer + trailing newline
return `${title}${prefix}${limitOptions({
output: opts.output,
Expand All @@ -184,7 +184,7 @@ export const multiselect = <Value>(opts: MultiSelectOptions<Value>) => {
}
default: {
const prefix = hasGuide ? `${styleText('cyan', S_BAR)} ` : '';
const titleLineCount = title.split('\n').length;
const titleLineCount = title.split('\n').length - 1;
const footerLines = showInstructions
? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, hasGuide)
: hasGuide
Expand Down
Loading