console : when moving to an old history, keep the position of the cursor if the user come back on the tmp stored entry
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4273 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -491,6 +491,7 @@ class console
|
|||||||
if ($string !== "" && $historyTmp == "")
|
if ($string !== "" && $historyTmp == "")
|
||||||
{
|
{
|
||||||
$historyTmp = $string;
|
$historyTmp = $string;
|
||||||
|
$historyTmpPos = $cursorPos;
|
||||||
}
|
}
|
||||||
if ($historyPos > 0)
|
if ($historyPos > 0)
|
||||||
{
|
{
|
||||||
@@ -511,12 +512,14 @@ class console
|
|||||||
{
|
{
|
||||||
$historyPos++;
|
$historyPos++;
|
||||||
$string = $this->history[$historyPos];
|
$string = $this->history[$historyPos];
|
||||||
|
$cursorPos = mb_strlen ($prompt.$string) + 1;
|
||||||
}
|
}
|
||||||
elseif ($historyTmp !== "")
|
elseif ($historyTmp !== "")
|
||||||
{
|
{
|
||||||
$string = $historyTmp;
|
$string = $historyTmp;
|
||||||
|
$cursorPos = $historyTmpPos;
|
||||||
|
$historyTmp = "";
|
||||||
}
|
}
|
||||||
$cursorPos = mb_strlen ($prompt.$string) + 1;
|
|
||||||
$this->rewriteLine ($prompt.$string);
|
$this->rewriteLine ($prompt.$string);
|
||||||
$this->moveCursor ($cursorPos);
|
$this->moveCursor ($cursorPos);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user