Skip to content

Commit

Permalink
fix: allow unicode characters in justify method
Browse files Browse the repository at this point in the history
  • Loading branch information
dimtrovich committed Nov 28, 2024
1 parent 4005ae4 commit 628ede7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Output/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function justify(string $first, ?string $second = null, array $options =

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

0 comments on commit 628ede7

Please sign in to comment.