From 9819b220196f203663a660e10e58e8f05762dc0d Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Fri, 4 Oct 2024 17:29:36 +0200 Subject: [PATCH] Prevent menu items from overflowing --- src/Editor/Menu.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Editor/Menu.php b/src/Editor/Menu.php index 16b1da0..4698c1c 100644 --- a/src/Editor/Menu.php +++ b/src/Editor/Menu.php @@ -110,6 +110,7 @@ class Menu } elseif (is_null($item)) { $item = str_repeat(" ", $width - 2); } else { + $item = mb_substr($item, 0, $width); $item = " " . $item . str_repeat(" ", $width - 3 - $this->itemlen($item)) . "\e[40;37m"; $item = (($n == $this->index)?"\e[37;44m":"\e[40;37m") . $item; }