diff --git a/src/Shell.php b/src/Shell.php index 82161f5..197184f 100644 --- a/src/Shell.php +++ b/src/Shell.php @@ -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