Prevent menu items from overflowing

This commit is contained in:
Chris 2024-10-04 17:29:36 +02:00
parent ed57eec3b0
commit 9819b22019

View File

@ -110,6 +110,7 @@ class Menu
} elseif (is_null($item)) { } elseif (is_null($item)) {
$item = str_repeat(" ", $width - 2); $item = str_repeat(" ", $width - 2);
} else { } else {
$item = mb_substr($item, 0, $width);
$item = " " . $item . str_repeat(" ", $width - 3 - $this->itemlen($item)) . "\e[40;37m"; $item = " " . $item . str_repeat(" ", $width - 3 - $this->itemlen($item)) . "\e[40;37m";
$item = (($n == $this->index)?"\e[37;44m":"\e[40;37m") . $item; $item = (($n == $this->index)?"\e[37;44m":"\e[40;37m") . $item;
} }