Description
I still see the error with PSReadline version: 2.0.0-beta5
Environment:
PS version: 5.1.18362.145
PSReadline version: 2.0.0-beta5
os: 10.0.18362.356 (WinBuild.160101.0800)
PS file version: 10.0.18362.356 (WinBuild.160101.0800)
HostName: ConsoleHost
BufferWidth: 219
BufferHeight: 29
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 -38.
at System.Console.SetCursorPosition(Int32 left, Int32 top)
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, Dictionary
2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
Steps to reproduce or exception report
Copy some thing big and paste it into the integrated terminal of Visual studio code.
All I had to do was copy the below script that grabs the environment data, This was sufficient to break PSReadline
&{
$hostName = $Host.Name
if ($hostName -eq "ConsoleHost" -and (Get-Command Get-CimInstance -ErrorAction SilentlyContinue)) {
$id = $PID
$inWindowsTerminal = $false
while ($true) {
$p = Get-CimInstance -ClassName Win32_Process -Filter "ProcessId Like $id"
if (!$p -or !$p.Name) { break }
if ($p.Name -eq "WindowsTerminal.exe") { $inWindowsTerminal = $true; break }
$id = $p.ParentProcessId
}
if ($inWindowsTerminal) { $hostName += " (Windows Terminal)" }
}
"PS version: $($PSVersionTable.PSVersion)"
$v = (Get-Module PSReadline).Version
$m = Get-Content "$ (Split-Path -Parent (Get-Module PSReadLine).Path)\PSReadLine.psd1" | Select-String "Prerelease = '(.*)'"
if ($m) {
$v = "$v-" + $m.Matches[0].Groups[1].Value
}
"PSReadline version: $v"
if ($IsLinux -or $IsMacOS) {
"os: $(uname -a)"
} else {
"os: $((dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion)"
}
"PS file version: $($name = if ($PSVersionTable.PSEdition -eq "Core") { "pwsh.dll" } else { "powershell.exe" }; (dir $pshome$name).VersionInfo.FileVersion)"
"HostName: $hostName"
"BufferWidth: $([console]::BufferWidth)"
"BufferHeight: $([console]::BufferHeight)`n"
}