Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: calculate box width without escape sequence chars
Browse files Browse the repository at this point in the history
xxhls committed Jan 8, 2025

Verified

This commit was signed with the committer’s verified signature.
zmiklank Zuzana Miklánková
1 parent 3190635 commit 32f85d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/box.ts
Original file line number Diff line number Diff line change
@@ -256,7 +256,7 @@ export function box(text: string, _opts: BoxOpts = {}) {
opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
const height = textLines.length + paddingOffset;
const width =
Math.max(...textLines.map((line) => line.length)) + paddingOffset;
Math.max(...textLines.map((line) => stripAnsi(line).length)) + paddingOffset;
const widthOffset = width + paddingOffset;

const leftSpace =

0 comments on commit 32f85d1

Please sign in to comment.