diff --git a/console.php b/console.php index 0abffc4..cd40c01 100644 --- a/console.php +++ b/console.php @@ -491,6 +491,7 @@ class console if ($string !== "" && $historyTmp == "") { $historyTmp = $string; + $historyTmpPos = $cursorPos; } if ($historyPos > 0) { @@ -511,12 +512,14 @@ class console { $historyPos++; $string = $this->history[$historyPos]; + $cursorPos = mb_strlen ($prompt.$string) + 1; } elseif ($historyTmp !== "") { $string = $historyTmp; + $cursorPos = $historyTmpPos; + $historyTmp = ""; } - $cursorPos = mb_strlen ($prompt.$string) + 1; $this->rewriteLine ($prompt.$string); $this->moveCursor ($cursorPos); }