Implement folding (use '+' key), clean up code
This commit is contained in:
@ -35,7 +35,16 @@ class MessageBox
|
||||
{
|
||||
$wrapped = explode("\n", wordwrap($this->text, $width - 4, cut_long_words:true));
|
||||
|
||||
if ($height == 0) $height = count($wrapped) + 4;
|
||||
[$w,$h] = $this->terminal->getSize();
|
||||
if ($height == 0) {
|
||||
$height = min($h - 5, count($wrapped) + 4);
|
||||
}
|
||||
if ($left == 0) {
|
||||
$left = round(($w - $width) / 2);
|
||||
}
|
||||
if ($top == 0) {
|
||||
$top = round(($h - $height) / 2);
|
||||
}
|
||||
|
||||
$maxScroll = (count($wrapped) > $height) ? count($wrapped) - $height + 4 : 0;
|
||||
|
||||
|
Reference in New Issue
Block a user