PowerShell / PSReadLine

A bash inspired readline implementation for PowerShell
BSD 2-Clause "Simplified" License
3.77k stars 298 forks source link

oop something went wrong #4189

Closed Romvisal closed 2 months ago

Romvisal commented 2 months ago

Prerequisites

Exception report

PS D:\PROGRAMER>
pyt
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 61 Keys:
 p y t h o n Space - u Space " d : \ P R O G R A M E R \ P Y T H O N \ R U P P \ l e a r n Space P y t h 
o n \ a p p l s i t . p y " 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: 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.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 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)

Screenshot

Screenshot 26

Environment data

PS D:\PROGRAMER>     $hostName = $Host.Name
nue)) {
>>         $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 D:\PROGRAMER>
PS D:\PROGRAMER>     $m = Get-Module PSReadline
PS D:\PROGRAMER>     $v = $m.Version; $pre = $m.PrivateData.PSData.Prerelease
PS D:\PROGRAMER>     if ($pre) { $v = "$v-$pre" }
PS D:\PROGRAMER>     $os = if ($IsLinux -or $IsMacOS) { uname -a } else { (dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion }
PS D:\PROGRAMER>
PS D:\PROGRAMER>     Write-Host ''

PS D:\PROGRAMER>     Write-Host "PS Version: $($PSVersionTable.PSVersion)"
PS Version: 5.1.19041.4648
PS D:\PROGRAMER>     Write-Host "PS HostName: $hostName"
PS HostName: ConsoleHost
PS D:\PROGRAMER>     Write-Host "PSReadLine Version: $v"
PSReadLine Version: 2.0.0-beta2
PS D:\PROGRAMER>     Write-Host "PSReadLine EditMode: $((Get-PSReadLineOption).EditMode)"
PSReadLine EditMode: Windows
PS D:\PROGRAMER>     Write-Host "OS: $os"
OS: 10.0.19041.1 (WinBuild.160101.0800)
PS D:\PROGRAMER>     Write-Host "BufferWidth: $([console]::BufferWidth)"
BufferWidth: 113
PS D:\PROGRAMER>     Write-Host "BufferHeight: $([console]::BufferHeight)"
BufferHeight: 35
PS D:\PROGRAMER>     Write-Host ''

PS D:\PROGRAMER>

Steps to reproduce

Screenshot 26

Expected behavior

start=int(input("Enter start: ")) stop=int(input("Enter stop: ")) list_year=[] for i in range(start,stop): if (i%400==0) or (i%4==0 and i%100!=0): list_year.append(i) print(list_year)

Actual behavior

Screenshot 26

Romvisal commented 2 months ago

Help me

github-actions[bot] commented 2 months ago

This issue was already fixed (see #1306). Please upgrade to the 2.3.5 version of PSReadLine from PowerShell Gallery. See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.