Skip to content

Commit 5db49e5

Browse files
committed
fix(note): prevent clack from re-breaking copy-sensitive tokens
wrapNoteMessage correctly preserves copy-sensitive tokens (paths, URLs) as unbroken lines, but clack's note() applies its own internal wrap after our format callback, re-breaking the line at the terminal width. Use a wide virtual stream (columns = max(80, longestLine + 12)) so clack's internal wrap never triggers, letting wrapNoteMessage's output pass through to the terminal intact. Fixes #94730
1 parent 01e5621 commit 5db49e5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

packages/terminal-core/src/note.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,13 @@ export function note(message: unknown, title?: string) {
207207
return;
208208
}
209209
const columns = resolveNoteColumns(process.stdout.columns);
210-
clackNote(wrapNoteMessage(message, { columns }), stylePromptTitle(title), {
211-
output: createNoteOutput(columns),
210+
const wrapped = wrapNoteMessage(message, { columns });
211+
// Use a wide virtual stream so clack's internal wrap (which runs after our
212+
// format callback) does not re-break copy-sensitive tokens that
213+
// wrapNoteMessage intentionally kept intact.
214+
const wideOutput = createNoteOutput(Math.max(columns, visibleWidth(wrapped) + 12));
215+
clackNote(wrapped, stylePromptTitle(title), {
216+
output: wideOutput,
212217
format: (line) => line,
213218
});
214219
}

0 commit comments

Comments
 (0)