Skip to content

Commit f145f2a

Browse files
author
Ildar Azizov
committed
fix: NoteRenderer padding for multibyte characters
Replace strlen and str_pad with mb_strlen and mb_str_pad to prevent visual glitches when using Cyrillic or other non-ASCII characters.
1 parent c14c6f4 commit f145f2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Themes/Default/NoteRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ public function __invoke(Note $note): string
1717
case 'intro':
1818
case 'outro':
1919
$lines = array_map(fn ($line) => " {$line} ", $lines);
20-
$longest = max(array_map(fn ($line) => strlen($line), $lines));
20+
$longest = max(array_map(fn ($line) => mb_strlen($line), $lines));
2121

2222
foreach ($lines as $line) {
23-
$line = str_pad($line, $longest, ' ');
23+
$line = mb_str_pad($line, $longest, ' ');
2424
$this->line(" {$this->bgCyan($this->black($line))}");
2525
}
2626

0 commit comments

Comments
 (0)