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
This commit is contained in:
2018-07-08 09:06:19 +00:00
parent f76b7dd76b
commit 11435d848e

View File

@@ -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);