Misc fixes
This commit is contained in:
@@ -53,13 +53,15 @@ class MessageBox
|
||||
|
||||
[$w,$h] = $this->terminal->getSize();
|
||||
if ($height == 0) {
|
||||
$height = min($h - 5, count($wrapped) + 4);
|
||||
$height = min($h - $top - 2, count($wrapped) + 4);
|
||||
}
|
||||
// again? oh well..
|
||||
$height = min($height, $h - $top - 2);
|
||||
if ($left == 0) {
|
||||
$left = round(($w - $width) / 2);
|
||||
}
|
||||
if ($top == 0) {
|
||||
$top = round(($h - $height) / 2);
|
||||
$top = (int)round(($h - $height) / 2);
|
||||
}
|
||||
|
||||
$maxScroll = (count($wrapped) > $height) ? count($wrapped) - $height + 4 : 0;
|
||||
@@ -127,6 +129,7 @@ class MessageBox
|
||||
* @return void
|
||||
*/
|
||||
private function redraw(int $left, int $top, int $width, int $height, array $wrapped, string $title, int $maxScroll) {
|
||||
|
||||
$visibleItems = $height - 4;
|
||||
|
||||
// calculate scrollbar thumb positions
|
||||
@@ -150,6 +153,8 @@ class MessageBox
|
||||
->writeAt($left, $top + $height - 1, self::U_CORNER_BOTTOMLEFT.str_repeat(self::U_EDGE_HORIZONTAL,$width - 2).self::U_CORNER_BOTTOMRIGHT)
|
||||
;
|
||||
for ($n = 0; $n < $visibleItems; $n++) {
|
||||
$pre = '';
|
||||
$post = '';
|
||||
if (isset($wrapped[$n+$this->scroll])) {
|
||||
$line = $wrapped[$n+$this->scroll]??null;
|
||||
if (str_starts_with($line, "# ")) {
|
||||
|
||||
Reference in New Issue
Block a user