You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PSReadLine crashes with ArgumentOutOfRangeException on SetCursorPosition when quickly editing long input line (top=29, BufferHeight=29) #5195
Search the existing issues, especially the pinned issues.
Exception report
# PSReadLine crashes with ArgumentOutOfRangeException on rapid Backspace editing## Environment- PowerShell: 7.x (console)- PSReadLine version: 2.4.5- Terminal: Windows Console host, BufferHeight = 29## Bug descriptionTyping commands and rapidly pressing Backspace caused PSReadLine to crash with`ArgumentOutOfRangeException` thrown from `SetCursorPosition`:Exception:System.Management.Automation.PSArgumentOutOfRangeException:Cannot process argument transformation on parameter 'top'.Parameter name: 'top' cannot be greater than '29'## Reproduction steps1. Open a PowerShell console with a short window (BufferHeight ~29).2. Type `vine update`, then `vine inventory`.3. Press Backspace ~13 times quickly to erase, retype `vine inventory`, press Enter.4. Press `r` — crash occurs.## Root cause analysis- The reported cursor line index is `29`, which is out of the valid range `0..28` when BufferHeight == 29.- The crash happened during input-line redraw after a burst of Backspace keys, suggesting PSReadLine's cursor position calculation went out of bounds (off-by-one at the bottom edge of the buffer).## Notes- This is not caused by the command itself — any command can trigger it when the buffer is short and Backspace is pressed rapidly.- Suggested fix: clamp the cursor `top` coordinate to `[0, BufferHeight-1]` before calling `SetCursorPosition`.## Reporter contextFound while testing **Vine** (https://codeberg.org/Milktown/vine), atext-instruction-based package manager for Windows. It has nothing to do withthe crash, just FYI — Vine is a neat open-source project worth a look. :)
Activity