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:
		@@ -118,6 +118,7 @@ class Shell implements WritableStreamInterface, EventEmitterInterface
 | 
				
			|||||||
                    $this->historyIndex++;
 | 
					                    $this->historyIndex++;
 | 
				
			||||||
                    $this->buffer = $this->history[$this->historyIndex];
 | 
					                    $this->buffer = $this->history[$this->historyIndex];
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                $this->cursorPos = min(strlen($this->buffer), $this->cursorPos) - $this->scrollOffset;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case "\e[B": // down
 | 
					            case "\e[B": // down
 | 
				
			||||||
                if ($this->historyIndex === null) {
 | 
					                if ($this->historyIndex === null) {
 | 
				
			||||||
@@ -130,6 +131,7 @@ class Shell implements WritableStreamInterface, EventEmitterInterface
 | 
				
			|||||||
                    $this->historyIndex--;
 | 
					                    $this->historyIndex--;
 | 
				
			||||||
                    $this->buffer = $this->history[$this->historyIndex];
 | 
					                    $this->buffer = $this->history[$this->historyIndex];
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                $this->cursorPos = min(strlen($this->buffer), $this->cursorPos) - $this->scrollOffset;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            case "\e[H": // home
 | 
					            case "\e[H": // home
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user