Skip to content

Commit 628ede7

Browse files
committed
fix: allow unicode characters in justify method
1 parent 4005ae4 commit 628ede7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Output/Writer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public function justify(string $first, ?string $second = null, array $options =
339339

340340
$second = (string) $second;
341341
$terminalWidth = $this->terminal->width() ?? 80;
342-
$dashWidth = $terminalWidth - (strlen($first) + strlen($second));
342+
$dashWidth = $terminalWidth - (mb_strwidth($first) + mb_strwidth($second));
343343
// remove left and right margins because we're going to add 1 space on each side (after/before the text).
344344
// if we don't have a second element, we just remove the left margin
345345
$dashWidth -= $second === '' ? 1 : 2;

0 commit comments

Comments
 (0)