diff --git a/console.php b/console.php index 2a21c3a..d7f7b63 100644 --- a/console.php +++ b/console.php @@ -70,6 +70,15 @@ private $usleep = 0; // Do not display anything, so we don't see the characters when the user is // deleting. exec ("stty -echo -icanon min 1 time 0"); + $this->updateTerminalSize (); + } + // }}} + + /** Update the terminal size + */ + public function updateTerminalSize () + // {{{ + { $termSize = exec ("stty size", $null, $rc); if ($rc === 0) { @@ -82,7 +91,7 @@ private $usleep = 0; else $this->termWidth = 80; } - // }}} + // }}} /** The destructor return the terminal to initial state */ @@ -323,7 +332,7 @@ private $usleep = 0; // Refresh page (Ctrl+L) // {{{ { - echo "\033[2J\033[;H"; + echo "\033[2J\033[;H\033c"; $cursorPos = mb_strlen ($prompt.$string) + 1; $this->rewriteLine ($prompt.$string); $this->moveCursor ($cursorPos);