Misc fixes
This commit is contained in:
+3
-3
@@ -83,12 +83,12 @@ class Menu
|
||||
* @param string|int|null $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function display(int $left, int $top, int $width, int $height = 0, string|int|null $value): mixed
|
||||
public function display(int $left, int $top, int $width, int $height = 0, string|int|null $value = null): mixed
|
||||
{
|
||||
//$this->index = 0;
|
||||
|
||||
$keys = array_keys($this->items);
|
||||
$this->index = array_search($value, $keys) ?? 0;
|
||||
$this->index = array_search($value, $keys) ?: 0;
|
||||
|
||||
[$w,$h] = $this->terminal->getSize();
|
||||
if ($height == 0) {
|
||||
@@ -187,7 +187,7 @@ class Menu
|
||||
$thumbTop = round(($visibleItems - 1) / count($this->items) * $scrollTop);
|
||||
$thumbBottom = round(($visibleItems) / count($this->items) * $scrollBottom);
|
||||
|
||||
$tleft = round(($width / 2) - ((mb_strlen($this->title) + 2) / 2));
|
||||
$tleft = (int)round(($width / 2) - ((mb_strlen($this->title) + 2) / 2));
|
||||
|
||||
// draw head
|
||||
echo "\e[40;37m";
|
||||
|
||||
Reference in New Issue
Block a user