PSReadLine
PSReadLine copied to clipboard
PSReadLine Error / Bug Report
Prerequisites
- [x] Write a descriptive title.
- [x] Make sure you are able to repro it on the latest released version
- [x] Search the existing issues, especially the pinned issues.
Exception report
Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!
### Environment
PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767
PowerShell: 7.5.0
OS: Linux Mint 22.1
BufferWidth: 209
BufferHeight: 29
Last 200 Keys:
l Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace 3 5 1 . x m l Enter
UpArrow Spacebar - Tab Tab l o Tab Spacebar Tab c o m Tab Enter
UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Tab Tab b a d Tab Enter
UpArrow Spacebar - Tab Tab J S Tab Backspace Backspace Backspace Backspace e x Tab Enter
UpArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow RightArrow 9 Delete RightArrow RightArrow RightArrow RightArrow RightArrow Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Delete Spacebar Enter
c a p l i s t Enter
r e s t a r t - r e q u e s t Spacebar 7 f 1 5 6 a a e - 8 4 a f - 4 1 0 0 - 8 9 9 d - 5 f e a 1 0 f 5 9 b c 7
### Exception
System.InvalidOperationException: Cannot locate the offset in the rendered text that was pointed by the original cursor. Initial Coord: (38, 31) Buffer: (209, 32) Cursor: (85, 28)
at Microsoft.PowerShell.PSConsoleReadLine.RecomputeInitialCoords(Boolean isTextBufferUnchanged)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
Screenshot
Environment data
PS Version: 7.5.0
PS HostName: ConsoleHost
PSReadLine Version: 2.3.6
PSReadLine EditMode: Emacs
OS: Linux p50 6.8.0-56-generic #58-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 14 15:33:28 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
BufferWidth: 209
BufferHeight: 32
Steps to reproduce
Run a local module function and paste in a value using CTRL+SHIFT+V for the input parameter. It's never done this before.
Expected behavior
No exceptions/errors.
Actual behavior
Displayed the error shown above.
I got a similar crash today: Exception:
System.ArgumentOutOfRangeException: The value must be greater than or
equal to zero and less than the console's buffer size in that dimension.
Parameter name: left
Actual value was -2.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable1 key, Object arg) at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object
arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
I get this same crash constantly from macOS Cursor IDE's AI Chat terminal. If I switch to zsh as the default shell, the problem goes away -- this bug makes it hard to vive code!
Environment
PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767 PowerShell: 7.5.1 OS: Darwin 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:29 PDT 2025; root:xnu-11417.121.6~2/RELEASE _ARM64_T6030 BufferWidth: 108 BufferHeight: 1
Last 185 Keys:
. Spacebar " / A p p l i c a t i o n s / C u r s o r . a p p / C o n t e n t s / R e s o u r c e s / a p p / o u t / v s / w o r k b e n c h / c o n t r i b / t e r m i n a l / c o m m o n / s c r i p t s / s h e l l I n t e g r a t i o n . p s 1 " Enter Ctrl+l Enter u v Spacebar t r e e Spacebar r e a d c h a r Enter u v Spacebar p i p Spacebar i n s t a l l Spacebar r e a d c h a r Spacebar & & Spacebar u v Spacebar t r e e S pacebar r e a d c h a r Enter
2 ~/code/bin main ≡
System.InvalidOperationException: Cannot locate the offset in the rendered text that was pointed by the orig
inal cursor. Initial Coord: (21, 7) Buffer: (108, 8) Cursor: (22, 0)
at Microsoft.PowerShell.PSConsoleReadLine.RecomputeInitialCoords(Boolean isTextBufferUnchanged)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Render()
at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolea
n ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics,
CancellationToken cancellationToken, Nullable`1 lastRunStatus)