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
ArgumentOutOfRangeException when snapping Windows Terminal from one screen to another screen's edge. #1155
Windows 10
Using Windows Terminal (Preview) version 0.6.2951.0
Steps to reproduce or exception report
All the other similar issues have already been closed, which is why I'm opening a new one.
I have two screens, one in portrait mode, another one in landscape mode. I had the Windows Terminal window on the landscape mode, and I moved it to the portrait mode. I waited for Windows to snap the window automatically to the edges, and that's when the crash message showed up:
PS D:\corefx>
Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new
### Environment
PSReadLine: 2.0.0-beta4
PowerShell: 7.0.0-preview.2
OS: Microsoft Windows 10.0.18363
Last 200 Keys
Enter
Enter
Enter
l s Enter
g i t k Enter
g i t Spacebar r e b a s e Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace g i t Spacebar r e b a s e Spacebar d o t n e t / m a s t e r Enter
g i t k Enter
c d Spacebar . . Enter
c d Spacebar d o t n e t - a p i - d o c s Enter
g i t Spacebar f e t c h Spacebar d o t n e t Enter
c d Spacebar . . Enter
c d Spacebar c o r e f x Enter
g i t Spacebar s t a t u s Enter
Enter
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: top
Actual value was 61.
at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate)
at Microsoft.PowerShell.PSConsoleReadLine.AcceptLine(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)
I ran the script you suggest in the issue description template. Here is the output:
Do you happen to have a command entered on the command line at the time this occurs? Did the window size change in the process? What was BufferWidth and BufferHeight before vs after?
changed the title [-]ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.[/-][+]ArgumentOutOfRangeException when snapping Windows Terminal from one screen to another screen's edge.[/+]on Nov 11, 2019
However, looking at everything again (sorry, I must have been distracted), this looks like something I just posted a PR for, #1182, though its different that you ran in to it. Did you press ENTER after the screen snap event? Was the cursor on the screen at that time? Was there a different in DPI's between the two screens?
I'm trying to come up with the scenario to reproduce the issue. WindowsTerminal does seem to do some weird things when moving from a larger window to a smaller one ...
Move it to a large screen and snap it to a vertical edge to make the window long (tall).
run some commands, so the buffer is full.
type a command, but do not enter it yet.
undock it from the edge so it reverts to a regular window.
press enter
It seems to help that the cursor is further down the buffer while the window is larger, than there is lines in the buffer when the window is smaller, with the command already typed out before the window is moved.
There is another issue, if you undock back to the smaller window, then dock again to a bigger window, the text will be scrolled up but the cursor will move back to the bottom on the next keypress.
I think PR #1182 takes care of this exception issue, from what I can test.
Activity
msftrncs commentedon Nov 6, 2019
Do you happen to have a command entered on the command line at the time this occurs? Did the window size change in the process? What was BufferWidth and BufferHeight before vs after?
Have you tried PSReadLine beta 5?
[-]ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.[/-][+]ArgumentOutOfRangeException when snapping Windows Terminal from one screen to another screen's edge.[/+]carlossanlop commentedon Nov 13, 2019
Carl Morris (@msftrncs)
The first 3 questions are answered by the text I pasted:
git statusmsftrncs commentedon Nov 14, 2019
Carlos Sánchez López (@carlossanlop), you are using PSReadLine 2.0.0-beta4, beta5 is out, beta6 is coming soon.
However, looking at everything again (sorry, I must have been distracted), this looks like something I just posted a PR for, #1182, though its different that you ran in to it. Did you press ENTER after the screen snap event? Was the cursor on the screen at that time? Was there a different in DPI's between the two screens?
I'm trying to come up with the scenario to reproduce the issue. WindowsTerminal does seem to do some weird things when moving from a larger window to a smaller one ...
msftrncs commentedon Nov 14, 2019
Okay, think I found it.
It seems to help that the cursor is further down the buffer while the window is larger, than there is lines in the buffer when the window is smaller, with the command already typed out before the window is moved.
There is another issue, if you undock back to the smaller window, then dock again to a bigger window, the text will be scrolled up but the cursor will move back to the bottom on the next keypress.
I think PR #1182 takes care of this exception issue, from what I can test.