From 953601038a42f27fed461f36f1f8779ad43b7e7d Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Fri, 5 Sep 2025 18:21:03 +0700 Subject: [PATCH 01/10] add fast-string-width --- packages/prompts/package.json | 5 +++-- pnpm-lock.yaml | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/prompts/package.json b/packages/prompts/package.json index 80c2e51d..5be4e69b 100644 --- a/packages/prompts/package.json +++ b/packages/prompts/package.json @@ -58,10 +58,11 @@ "sisteransi": "^1.0.5" }, "devDependencies": { + "fast-string-width": "^3.0.1", + "fast-wrap-ansi": "^0.1.3", "is-unicode-supported": "^1.3.0", "memfs": "^4.17.2", "vitest": "^3.2.4", - "vitest-ansi-serializer": "^0.1.2", - "fast-wrap-ansi": "^0.1.3" + "vitest-ansi-serializer": "^0.1.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 95e45a8b..d1a7f720 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,6 +86,9 @@ importers: specifier: ^1.0.5 version: 1.0.5 devDependencies: + fast-string-width: + specifier: ^3.0.1 + version: 3.0.1 fast-wrap-ansi: specifier: ^0.1.3 version: 0.1.3 @@ -985,9 +988,15 @@ packages: fast-string-truncated-width@1.2.1: resolution: {integrity: sha512-Q9acT/+Uu3GwGj+5w/zsGuQjh9O1TyywhIwAxHudtWrgF09nHOPrvTLhQevPbttcxjr/SNN7mJmfOw/B1bXgow==} + fast-string-truncated-width@3.0.1: + resolution: {integrity: sha512-tHCvcq0zdQ0NoTG3LJ1VlepCq7m4eAVMsbNrta9IlYxCPvgyoVJPl0rUbi+jTCkJLRQKfadVKNBuAlaa4nQJIw==} + fast-string-width@1.1.0: resolution: {integrity: sha512-O3fwIVIH5gKB38QNbdg+3760ZmGz0SZMgvwJbA1b2TGXceKE6A2cOlfogh1iw8lr049zPyd7YADHy+B7U4W9bQ==} + fast-string-width@3.0.1: + resolution: {integrity: sha512-8R+/9ppmJ+wcdnT21jIi+s2vqMhmRN/5TRmWVSiSeNBV5s26siCStF6R84LSLARPR/MSmE/z2bgBf7PCQxnwMg==} + fast-wrap-ansi@0.1.3: resolution: {integrity: sha512-iLg8mLuZBztzm8jmY6/xjr+ci4WYo6eYgHAioTA1ElxkE1BJ9J4tPuDlnHaLfljkRZ2vYfP0CDIpCHBBag4InA==} @@ -2675,10 +2684,16 @@ snapshots: fast-string-truncated-width@1.2.1: {} + fast-string-truncated-width@3.0.1: {} + fast-string-width@1.1.0: dependencies: fast-string-truncated-width: 1.2.1 + fast-string-width@3.0.1: + dependencies: + fast-string-truncated-width: 3.0.1 + fast-wrap-ansi@0.1.3: dependencies: fast-string-width: 1.1.0 From e21e4b9d2c44f220d2039435bfc0427602e26dc4 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Fri, 5 Sep 2025 18:27:45 +0700 Subject: [PATCH 02/10] fix: handle cjk in note component --- packages/prompts/src/note.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/prompts/src/note.ts b/packages/prompts/src/note.ts index 7af69f13..6b07055a 100644 --- a/packages/prompts/src/note.ts +++ b/packages/prompts/src/note.ts @@ -1,6 +1,5 @@ import process from 'node:process'; import type { Writable } from 'node:stream'; -import { stripVTControlCharacters as strip } from 'node:util'; import { getColumns } from '@clack/core'; import { type Options as WrapAnsiOptions, wrapAnsi } from 'fast-wrap-ansi'; import color from 'picocolors'; @@ -13,6 +12,7 @@ import { S_CORNER_TOP_RIGHT, S_STEP_SUBMIT, } from './common.js'; +import stringWidth from "fast-string-width"; type FormatFn = (line: string) => string; export interface NoteOptions extends CommonOptions { @@ -27,10 +27,10 @@ const wrapWithFormat = (message: string, width: number, format: FormatFn): strin trim: false, }; const wrapMsg = wrapAnsi(message, width, opts).split('\n'); - const maxWidthNormal = wrapMsg.reduce((sum, ln) => Math.max(strip(ln).length, sum), 0); + const maxWidthNormal = wrapMsg.reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0); const maxWidthFormat = wrapMsg .map(format) - .reduce((sum, ln) => Math.max(strip(ln).length, sum), 0); + .reduce((sum, ln) => Math.max(stringWidth(ln), sum), 0); const wrapWidth = width - (maxWidthFormat - maxWidthNormal); return wrapAnsi(message, wrapWidth, opts); }; @@ -40,18 +40,18 @@ export const note = (message = '', title = '', opts?: NoteOptions) => { const format = opts?.format ?? defaultNoteFormatter; const wrapMsg = wrapWithFormat(message, getColumns(output) - 6, format); const lines = ['', ...wrapMsg.split('\n').map(format), '']; - const titleLen = strip(title).length; + const titleLen = stringWidth(title); const len = Math.max( lines.reduce((sum, ln) => { - const line = strip(ln); - return line.length > sum ? line.length : sum; + const width = stringWidth(ln); + return width > sum ? width : sum; }, 0), titleLen ) + 2; const msg = lines .map( - (ln) => `${color.gray(S_BAR)} ${ln}${' '.repeat(len - strip(ln).length)}${color.gray(S_BAR)}` + (ln) => `${color.gray(S_BAR)} ${ln}${' '.repeat(len - stringWidth(ln))}${color.gray(S_BAR)}` ) .join('\n'); output.write( From e3172aafd26c254ddd1467bde94ee677160c1445 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Fri, 5 Sep 2025 18:32:42 +0700 Subject: [PATCH 03/10] fix: handle cjk in box component --- packages/prompts/src/box.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/prompts/src/box.ts b/packages/prompts/src/box.ts index 0e145d6e..e19f4574 100644 --- a/packages/prompts/src/box.ts +++ b/packages/prompts/src/box.ts @@ -14,6 +14,7 @@ import { S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, } from './common.js'; +import stringWidth from "fast-string-width"; export type BoxAlignment = 'left' | 'center' | 'right'; @@ -72,13 +73,13 @@ export const box = (message = '', title = '', opts?: BoxOptions) => { const symbols = (opts?.rounded ? roundedSymbols : squareSymbols).map(formatBorder); const hSymbol = formatBorder(S_BAR_H); const vSymbol = formatBorder(S_BAR); - const maxBoxWidth = columns - linePrefix.length; - let boxWidth = Math.floor(columns * width) - linePrefix.length; + const maxBoxWidth = columns - stringWidth(linePrefix); + let boxWidth = Math.floor(columns * width) - stringWidth(linePrefix); if (opts?.width === 'auto') { const lines = message.split('\n'); - let longestLine = title.length + titlePadding * 2; + let longestLine = stringWidth(title) + titlePadding * 2; for (const line of lines) { - const lineWithPadding = line.length + contentPadding * 2; + const lineWithPadding = stringWidth(line) + contentPadding * 2; if (lineWithPadding > longestLine) { longestLine = lineWithPadding; } @@ -98,9 +99,9 @@ export const box = (message = '', title = '', opts?: BoxOptions) => { const innerWidth = boxWidth - borderTotalWidth; const maxTitleLength = innerWidth - titlePadding * 2; const truncatedTitle = - title.length > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title; + stringWidth(title) > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title; const [titlePaddingLeft, titlePaddingRight] = getPaddingForLine( - truncatedTitle.length, + stringWidth(truncatedTitle), innerWidth, titlePadding, opts?.titleAlign @@ -115,7 +116,7 @@ export const box = (message = '', title = '', opts?: BoxOptions) => { const wrappedLines = wrappedMessage.split('\n'); for (const line of wrappedLines) { const [leftLinePadding, rightLinePadding] = getPaddingForLine( - line.length, + stringWidth(line), innerWidth, contentPadding, opts?.contentAlign From 7df58e322b49b39298f6798611658464177988ba Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Fri, 5 Sep 2025 18:54:43 +0700 Subject: [PATCH 04/10] downgrade fast-string-width --- packages/prompts/package.json | 2 +- pnpm-lock.yaml | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/prompts/package.json b/packages/prompts/package.json index 5be4e69b..2b5566d4 100644 --- a/packages/prompts/package.json +++ b/packages/prompts/package.json @@ -58,7 +58,7 @@ "sisteransi": "^1.0.5" }, "devDependencies": { - "fast-string-width": "^3.0.1", + "fast-string-width": "^1.1.0", "fast-wrap-ansi": "^0.1.3", "is-unicode-supported": "^1.3.0", "memfs": "^4.17.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d1a7f720..2c19acf1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -87,8 +87,8 @@ importers: version: 1.0.5 devDependencies: fast-string-width: - specifier: ^3.0.1 - version: 3.0.1 + specifier: ^1.1.0 + version: 1.1.0 fast-wrap-ansi: specifier: ^0.1.3 version: 0.1.3 @@ -988,15 +988,9 @@ packages: fast-string-truncated-width@1.2.1: resolution: {integrity: sha512-Q9acT/+Uu3GwGj+5w/zsGuQjh9O1TyywhIwAxHudtWrgF09nHOPrvTLhQevPbttcxjr/SNN7mJmfOw/B1bXgow==} - fast-string-truncated-width@3.0.1: - resolution: {integrity: sha512-tHCvcq0zdQ0NoTG3LJ1VlepCq7m4eAVMsbNrta9IlYxCPvgyoVJPl0rUbi+jTCkJLRQKfadVKNBuAlaa4nQJIw==} - fast-string-width@1.1.0: resolution: {integrity: sha512-O3fwIVIH5gKB38QNbdg+3760ZmGz0SZMgvwJbA1b2TGXceKE6A2cOlfogh1iw8lr049zPyd7YADHy+B7U4W9bQ==} - fast-string-width@3.0.1: - resolution: {integrity: sha512-8R+/9ppmJ+wcdnT21jIi+s2vqMhmRN/5TRmWVSiSeNBV5s26siCStF6R84LSLARPR/MSmE/z2bgBf7PCQxnwMg==} - fast-wrap-ansi@0.1.3: resolution: {integrity: sha512-iLg8mLuZBztzm8jmY6/xjr+ci4WYo6eYgHAioTA1ElxkE1BJ9J4tPuDlnHaLfljkRZ2vYfP0CDIpCHBBag4InA==} @@ -2684,16 +2678,10 @@ snapshots: fast-string-truncated-width@1.2.1: {} - fast-string-truncated-width@3.0.1: {} - fast-string-width@1.1.0: dependencies: fast-string-truncated-width: 1.2.1 - fast-string-width@3.0.1: - dependencies: - fast-string-truncated-width: 3.0.1 - fast-wrap-ansi@0.1.3: dependencies: fast-string-width: 1.1.0 From a29d0678dd4c8e986e263134a274025fe652ead9 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Mon, 8 Sep 2025 07:56:54 +0700 Subject: [PATCH 05/10] store linePrefix & title width --- packages/prompts/src/box.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/prompts/src/box.ts b/packages/prompts/src/box.ts index e19f4574..398f7465 100644 --- a/packages/prompts/src/box.ts +++ b/packages/prompts/src/box.ts @@ -73,11 +73,13 @@ export const box = (message = '', title = '', opts?: BoxOptions) => { const symbols = (opts?.rounded ? roundedSymbols : squareSymbols).map(formatBorder); const hSymbol = formatBorder(S_BAR_H); const vSymbol = formatBorder(S_BAR); - const maxBoxWidth = columns - stringWidth(linePrefix); - let boxWidth = Math.floor(columns * width) - stringWidth(linePrefix); + const linePrefixWidth = stringWidth(linePrefix); + const titleWidth = stringWidth(title); + const maxBoxWidth = columns - linePrefixWidth; + let boxWidth = Math.floor(columns * width) - linePrefixWidth; if (opts?.width === 'auto') { const lines = message.split('\n'); - let longestLine = stringWidth(title) + titlePadding * 2; + let longestLine = titleWidth + titlePadding * 2; for (const line of lines) { const lineWithPadding = stringWidth(line) + contentPadding * 2; if (lineWithPadding > longestLine) { @@ -99,7 +101,7 @@ export const box = (message = '', title = '', opts?: BoxOptions) => { const innerWidth = boxWidth - borderTotalWidth; const maxTitleLength = innerWidth - titlePadding * 2; const truncatedTitle = - stringWidth(title) > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title; + titleWidth > maxTitleLength ? `${title.slice(0, maxTitleLength - 3)}...` : title; const [titlePaddingLeft, titlePaddingRight] = getPaddingForLine( stringWidth(truncatedTitle), innerWidth, From 92f82fe860df73ad3c9c33f1516fdf831c84fc06 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Mon, 8 Sep 2025 15:38:48 +0700 Subject: [PATCH 06/10] add tests for note component --- .../test/__snapshots__/note.test.ts.snap | 52 +++++++++++++++++++ packages/prompts/test/note.test.ts | 27 ++++++++++ 2 files changed, 79 insertions(+) diff --git a/packages/prompts/test/__snapshots__/note.test.ts.snap b/packages/prompts/test/__snapshots__/note.test.ts.snap index bb1bd673..b1017a33 100644 --- a/packages/prompts/test/__snapshots__/note.test.ts.snap +++ b/packages/prompts/test/__snapshots__/note.test.ts.snap @@ -98,6 +98,32 @@ exports[`note (isCI = false) > formatter which adds length works 1`] = ` ] `; +exports[`note (isCI = false) > handle wide characters 1`] = ` +[ + "โ”‚ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” โ”‚ +โ”‚ ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +", +] +`; + +exports[`note (isCI = false) > handle wide characters with formatter 1`] = ` +[ + "โ”‚ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ * ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” * โ”‚ +โ”‚ * ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ * โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +", +] +`; + exports[`note (isCI = false) > renders as wide as longest line 1`] = ` [ "โ”‚ @@ -221,6 +247,32 @@ exports[`note (isCI = true) > formatter which adds length works 1`] = ` ] `; +exports[`note (isCI = true) > handle wide characters 1`] = ` +[ + "โ”‚ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” โ”‚ +โ”‚ ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +", +] +`; + +exports[`note (isCI = true) > handle wide characters with formatter 1`] = ` +[ + "โ”‚ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ * ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” * โ”‚ +โ”‚ * ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ * โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +", +] +`; + exports[`note (isCI = true) > renders as wide as longest line 1`] = ` [ "โ”‚ diff --git a/packages/prompts/test/note.test.ts b/packages/prompts/test/note.test.ts index 85ca4ebe..fa776fc0 100644 --- a/packages/prompts/test/note.test.ts +++ b/packages/prompts/test/note.test.ts @@ -84,4 +84,31 @@ describe.each(['true', 'false'])('note (isCI = %s)', (isCI) => { expect(output.buffer).toMatchSnapshot(); }); + + test("handle wide characters", () => { + const messages = [ + '์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š”', + 'ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™', + ]; + prompts.note(messages.join("\n"), '่ฟ™ๆ˜ฏๆ ‡้ข˜', { + input, + output: Object.assign(output, { columns: 10 }), + }); + + expect(output.buffer).toMatchSnapshot(); + }); + + test("handle wide characters with formatter", () => { + const messages = [ + '์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š”', + 'ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™', + ]; + prompts.note(messages.join("\n"), '่ฟ™ๆ˜ฏๆ ‡้ข˜', { + format: (line) => colors.red(`* ${colors.cyan(line)} *`), + input, + output: Object.assign(output, { columns: 10 }), + }); + + expect(output.buffer).toMatchSnapshot(); + }); }); From ec7af36e3f1b8d7ff2adce85803c8480cf878b4a Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Mon, 8 Sep 2025 15:54:58 +0700 Subject: [PATCH 07/10] add tests for box component --- .../test/__snapshots__/box.test.ts.snap | 64 +++++++++++++++++++ packages/prompts/test/box.test.ts | 28 ++++++++ 2 files changed, 92 insertions(+) diff --git a/packages/prompts/test/__snapshots__/box.test.ts.snap b/packages/prompts/test/__snapshots__/box.test.ts.snap index 60cc91ec..63f3b8c7 100644 --- a/packages/prompts/test/__snapshots__/box.test.ts.snap +++ b/packages/prompts/test/__snapshots__/box.test.ts.snap @@ -191,6 +191,38 @@ exports[`box (isCI = false) > renders truncated long titles 1`] = ` ] `; +exports[`box (isCI = false) > renders wide characters with auto width 1`] = ` +[ + "โ”Œโ”€่ฟ™ๆ˜ฏๆ ‡้ข˜โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +", + "โ”‚ ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” โ”‚ +", + "โ”‚ ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ โ”‚ +", + "โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +", +] +`; + +exports[`box (isCI = false) > renders wide characters with specified width 1`] = ` +[ + "โ”Œโ”€่ฟ™ๆ˜ฏๆ ‡้ข˜โ”€โ”€โ”€โ”€โ”€โ” +", + "โ”‚ ์ด๊ฒŒ ์ฒซ โ”‚ +", + "โ”‚ ๋ฒˆ์งธ โ”‚ +", + "โ”‚ ์ค„์ด์—์š” โ”‚ +", + "โ”‚ ใ“ใ‚Œใฏๆฌกใฎ โ”‚ +", + "โ”‚ ่กŒใงใ™ โ”‚ +", + "โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +", +] +`; + exports[`box (isCI = false) > renders with formatBorder formatting 1`] = ` [ "โ”Œโ”€titleโ”€โ”€โ”€โ”€โ”€โ”€โ” @@ -423,6 +455,38 @@ exports[`box (isCI = true) > renders truncated long titles 1`] = ` ] `; +exports[`box (isCI = true) > renders wide characters with auto width 1`] = ` +[ + "โ”Œโ”€่ฟ™ๆ˜ฏๆ ‡้ข˜โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +", + "โ”‚ ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” โ”‚ +", + "โ”‚ ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ โ”‚ +", + "โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +", +] +`; + +exports[`box (isCI = true) > renders wide characters with specified width 1`] = ` +[ + "โ”Œโ”€่ฟ™ๆ˜ฏๆ ‡้ข˜โ”€โ”€โ”€โ”€โ”€โ” +", + "โ”‚ ์ด๊ฒŒ ์ฒซ โ”‚ +", + "โ”‚ ๋ฒˆ์งธ โ”‚ +", + "โ”‚ ์ค„์ด์—์š” โ”‚ +", + "โ”‚ ใ“ใ‚Œใฏๆฌกใฎ โ”‚ +", + "โ”‚ ่กŒใงใ™ โ”‚ +", + "โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +", +] +`; + exports[`box (isCI = true) > renders with formatBorder formatting 1`] = ` [ "โ”Œโ”€titleโ”€โ”€โ”€โ”€โ”€โ”€โ” diff --git a/packages/prompts/test/box.test.ts b/packages/prompts/test/box.test.ts index 69cd205d..8c9a2249 100644 --- a/packages/prompts/test/box.test.ts +++ b/packages/prompts/test/box.test.ts @@ -234,4 +234,32 @@ describe.each(['true', 'false'])('box (isCI = %s)', (isCI) => { expect(output.buffer).toMatchSnapshot(); }); + + test('renders wide characters with auto width', () => { + const messages = [ + '์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š”', + 'ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™', + ]; + prompts.box(messages.join("\n"), '่ฟ™ๆ˜ฏๆ ‡้ข˜', { + input, + output, + width: 'auto', + }); + + expect(output.buffer).toMatchSnapshot(); + }); + + test('renders wide characters with specified width', () => { + const messages = [ + '์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š”', + 'ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™', + ]; + prompts.box(messages.join("\n"), '่ฟ™ๆ˜ฏๆ ‡้ข˜', { + input, + output, + width: 0.2, + }); + + expect(output.buffer).toMatchSnapshot(); + }); }); From d62e1ed6f8d409d38ae9ed13f633451a3ddf87ad Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Mon, 8 Sep 2025 17:26:58 +0700 Subject: [PATCH 08/10] update tests --- packages/prompts/test/note.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/prompts/test/note.test.ts b/packages/prompts/test/note.test.ts index 72ea13a7..775b29dc 100644 --- a/packages/prompts/test/note.test.ts +++ b/packages/prompts/test/note.test.ts @@ -66,6 +66,7 @@ describe.each(['true', 'false'])('note (isCI = %s)', (isCI) => { test("don't overflow", () => { const message = `${'test string '.repeat(32)}\n`.repeat(4).trim(); + output.columns = 75; prompts.note(message, 'title', { input, output, @@ -76,6 +77,7 @@ describe.each(['true', 'false'])('note (isCI = %s)', (isCI) => { test("don't overflow with formatter", () => { const message = `${'test string '.repeat(32)}\n`.repeat(4).trim(); + output.columns = 75; prompts.note(message, 'title', { format: (line) => colors.red(`* ${colors.cyan(line)} *`), input, @@ -90,9 +92,10 @@ describe.each(['true', 'false'])('note (isCI = %s)', (isCI) => { '์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š”', 'ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™', ]; + output.columns = 10; prompts.note(messages.join("\n"), '่ฟ™ๆ˜ฏๆ ‡้ข˜', { input, - output: Object.assign(output, { columns: 10 }), + output, }); expect(output.buffer).toMatchSnapshot(); @@ -103,10 +106,11 @@ describe.each(['true', 'false'])('note (isCI = %s)', (isCI) => { '์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š”', 'ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™', ]; + output.columns = 10; prompts.note(messages.join("\n"), '่ฟ™ๆ˜ฏๆ ‡้ข˜', { format: (line) => colors.red(`* ${colors.cyan(line)} *`), input, - output: Object.assign(output, { columns: 10 }), + output, }); expect(output.buffer).toMatchSnapshot(); From f9fdbaa0f8d7a9baf95c018d6034217dffe19b85 Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Mon, 8 Sep 2025 17:45:59 +0700 Subject: [PATCH 09/10] update snapshots --- .../test/__snapshots__/note.test.ts.snap | 336 +++++++++++------- 1 file changed, 200 insertions(+), 136 deletions(-) diff --git a/packages/prompts/test/__snapshots__/note.test.ts.snap b/packages/prompts/test/__snapshots__/note.test.ts.snap index b1017a33..ccb42566 100644 --- a/packages/prompts/test/__snapshots__/note.test.ts.snap +++ b/packages/prompts/test/__snapshots__/note.test.ts.snap @@ -3,34 +3,34 @@ exports[`note (isCI = false) > don't overflow 1`] = ` [ "โ”‚ -โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; @@ -38,34 +38,38 @@ exports[`note (isCI = false) > don't overflow 1`] = ` exports[`note (isCI = false) > don't overflow with formatter 1`] = ` [ "โ”‚ -โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string * โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string  * โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string  * โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string  * โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string * โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; @@ -101,12 +105,20 @@ exports[`note (isCI = false) > formatter which adds length works 1`] = ` exports[`note (isCI = false) > handle wide characters 1`] = ` [ "โ”‚ -โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” โ”‚ -โ”‚ ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ ์ด๊ฒŒ โ”‚ +โ”‚  ์ฒซ  โ”‚ +โ”‚ ๋ฒˆ์งธ โ”‚ +โ”‚   โ”‚ +โ”‚ ์ค„์ด โ”‚ +โ”‚ ์—์š” โ”‚ +โ”‚ ใ“ใ‚Œ โ”‚ +โ”‚ ใฏๆฌก โ”‚ +โ”‚ ใฎ่กŒ โ”‚ +โ”‚ ใงใ™ โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; @@ -114,12 +126,32 @@ exports[`note (isCI = false) > handle wide characters 1`] = ` exports[`note (isCI = false) > handle wide characters with formatter 1`] = ` [ "โ”‚ -โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ * ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” * โ”‚ -โ”‚ * ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ * โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ *  * โ”‚ +โ”‚ * ์ด * โ”‚ +โ”‚ * ๊ฒŒ * โ”‚ +โ”‚ *   * โ”‚ +โ”‚ * ์ฒซ * โ”‚ +โ”‚ *   * โ”‚ +โ”‚ * ๋ฒˆ * โ”‚ +โ”‚ * ์งธ * โ”‚ +โ”‚ *   * โ”‚ +โ”‚ * ์ค„ * โ”‚ +โ”‚ * ์ด * โ”‚ +โ”‚ * ์— * โ”‚ +โ”‚ * ์š” * โ”‚ +โ”‚ *  * โ”‚ +โ”‚ * ใ“ * โ”‚ +โ”‚ * ใ‚Œ * โ”‚ +โ”‚ * ใฏ * โ”‚ +โ”‚ * ๆฌก * โ”‚ +โ”‚ * ใฎ * โ”‚ +โ”‚ * ่กŒ * โ”‚ +โ”‚ * ใง * โ”‚ +โ”‚ * ใ™ * โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; @@ -152,34 +184,34 @@ exports[`note (isCI = false) > renders message with title 1`] = ` exports[`note (isCI = true) > don't overflow 1`] = ` [ "โ”‚ -โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string test string test string test string test string  โ”‚ -โ”‚ test string test string โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string test string  โ”‚ +โ”‚ test string test string test string test string test string test  โ”‚ +โ”‚ string test string test string test string test string โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; @@ -187,34 +219,38 @@ exports[`note (isCI = true) > don't overflow 1`] = ` exports[`note (isCI = true) > don't overflow with formatter 1`] = ` [ "โ”‚ -โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string test string  * โ”‚ -โ”‚ * test string test string test string test string test string test  * โ”‚ -โ”‚ * string test string test string test string test string * โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ title โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string  * โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string  * โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string  * โ”‚ +โ”‚ * test string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string test string test string test string test  * โ”‚ +โ”‚ * string test string * โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; @@ -250,12 +286,20 @@ exports[`note (isCI = true) > formatter which adds length works 1`] = ` exports[`note (isCI = true) > handle wide characters 1`] = ` [ "โ”‚ -โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” โ”‚ -โ”‚ ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ ์ด๊ฒŒ โ”‚ +โ”‚  ์ฒซ  โ”‚ +โ”‚ ๋ฒˆ์งธ โ”‚ +โ”‚   โ”‚ +โ”‚ ์ค„์ด โ”‚ +โ”‚ ์—์š” โ”‚ +โ”‚ ใ“ใ‚Œ โ”‚ +โ”‚ ใฏๆฌก โ”‚ +โ”‚ ใฎ่กŒ โ”‚ +โ”‚ ใงใ™ โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; @@ -263,12 +307,32 @@ exports[`note (isCI = true) > handle wide characters 1`] = ` exports[`note (isCI = true) > handle wide characters with formatter 1`] = ` [ "โ”‚ -โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -โ”‚ โ”‚ -โ”‚ * ์ด๊ฒŒ ์ฒซ ๋ฒˆ์งธ ์ค„์ด์—์š” * โ”‚ -โ”‚ * ใ“ใ‚Œใฏๆฌกใฎ่กŒใงใ™ * โ”‚ -โ”‚ โ”‚ -โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ +โ—‡ ่ฟ™ๆ˜ฏๆ ‡้ข˜ โ”€โ•ฎ +โ”‚ โ”‚ +โ”‚ *  * โ”‚ +โ”‚ * ์ด * โ”‚ +โ”‚ * ๊ฒŒ * โ”‚ +โ”‚ *   * โ”‚ +โ”‚ * ์ฒซ * โ”‚ +โ”‚ *   * โ”‚ +โ”‚ * ๋ฒˆ * โ”‚ +โ”‚ * ์งธ * โ”‚ +โ”‚ *   * โ”‚ +โ”‚ * ์ค„ * โ”‚ +โ”‚ * ์ด * โ”‚ +โ”‚ * ์— * โ”‚ +โ”‚ * ์š” * โ”‚ +โ”‚ *  * โ”‚ +โ”‚ * ใ“ * โ”‚ +โ”‚ * ใ‚Œ * โ”‚ +โ”‚ * ใฏ * โ”‚ +โ”‚ * ๆฌก * โ”‚ +โ”‚ * ใฎ * โ”‚ +โ”‚ * ่กŒ * โ”‚ +โ”‚ * ใง * โ”‚ +โ”‚ * ใ™ * โ”‚ +โ”‚ โ”‚ +โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ", ] `; From 76347917d4b9dc89c59967c582d79fa17afc034f Mon Sep 17 00:00:00 2001 From: hyperz111 Date: Mon, 8 Sep 2025 18:06:23 +0700 Subject: [PATCH 10/10] add changeset --- .changeset/lucky-dragons-think.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lucky-dragons-think.md diff --git a/.changeset/lucky-dragons-think.md b/.changeset/lucky-dragons-think.md new file mode 100644 index 00000000..ffb40962 --- /dev/null +++ b/.changeset/lucky-dragons-think.md @@ -0,0 +1,5 @@ +--- +"@clack/prompts": patch +--- + +fix(note, box): handle CJK correctly