Add PgUp/Dn/Home/End to menu, bugfixes
This commit is contained in:
@@ -27,10 +27,26 @@ class MessageBox
|
||||
|
||||
private int $scroll = 0;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param Terminal $terminal
|
||||
* @param string $text
|
||||
* @param string $title
|
||||
*/
|
||||
public function __construct(private Terminal $terminal, private string $text, private string $title = 'Message')
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the message box
|
||||
*
|
||||
* @param int $left
|
||||
* @param int $top
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @return void
|
||||
*/
|
||||
public function display(int $left, int $top, int $width, int $height = 0): void
|
||||
{
|
||||
$wrapped = explode("\n", wordwrap($this->text, $width - 4, cut_long_words:true));
|
||||
@@ -76,6 +92,18 @@ class MessageBox
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraw the message box
|
||||
*
|
||||
* @param int $left
|
||||
* @param int $top
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @param array $wrapped
|
||||
* @param string $title
|
||||
* @param int $maxScroll
|
||||
* @return void
|
||||
*/
|
||||
private function redraw(int $left, int $top, int $width, int $height, array $wrapped, string $title, int $maxScroll) {
|
||||
$visibleItems = $height - 4;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user