diff --git a/console.php b/console.php index cd40c01..30e5e2b 100644 --- a/console.php +++ b/console.php @@ -267,7 +267,6 @@ class console $minLength = mb_strlen ($this->lineContent) + 1; // Manage the history and a temporary buffer if the user has already type // something before calling the history - $historyTmp = ""; $historyPos = count ($this->history); $string = $propo; echo $string; @@ -488,7 +487,7 @@ class console // {{{ { $this->debug ("Cursor up"); - if ($string !== "" && $historyTmp == "") + if (! isset ($historyTmp)) { $historyTmp = $string; $historyTmpPos = $cursorPos; @@ -514,11 +513,11 @@ class console $string = $this->history[$historyPos]; $cursorPos = mb_strlen ($prompt.$string) + 1; } - elseif ($historyTmp !== "") + elseif (isset ($historyTmp)) { $string = $historyTmp; $cursorPos = $historyTmpPos; - $historyTmp = ""; + unset ($historyTmp); } $this->rewriteLine ($prompt.$string); $this->moveCursor ($cursorPos);