From 11435d848e4c7cd8fe9f78b19d1bcf38b7456b3a Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Sun, 8 Jul 2018 09:06:19 +0000 Subject: [PATCH] console : manage correctely the tmp value stored when using the history git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4274 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- console.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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);