Bugfix history cursor position
* Added check to make sure that the cursor does not remain past the end of the line when scrolling to a shorter entry.
This commit is contained in:
parent
6eddf0e847
commit
14f1d7f0cf
@ -118,6 +118,7 @@ class Shell implements WritableStreamInterface, EventEmitterInterface
|
||||
$this->historyIndex++;
|
||||
$this->buffer = $this->history[$this->historyIndex];
|
||||
}
|
||||
$this->cursorPos = min(strlen($this->buffer), $this->cursorPos) - $this->scrollOffset;
|
||||
break;
|
||||
case "\e[B": // down
|
||||
if ($this->historyIndex === null) {
|
||||
@ -130,6 +131,7 @@ class Shell implements WritableStreamInterface, EventEmitterInterface
|
||||
$this->historyIndex--;
|
||||
$this->buffer = $this->history[$this->historyIndex];
|
||||
}
|
||||
$this->cursorPos = min(strlen($this->buffer), $this->cursorPos) - $this->scrollOffset;
|
||||
break;
|
||||
|
||||
case "\e[H": // home
|
||||
|
Loading…
Reference in New Issue
Block a user