PowerShell / PSReadLine

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

Powershell/Debugpy exception #4238

Closed bjorkelundflyhau closed 1 month ago

bjorkelundflyhau commented 1 month ago

Prerequisites

Exception report

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 200 Keys:
 o n . d e b u g p y - 2 0 2 4 . 1 2 . 0 - w i n 3 2 - x 6 4 \ b u n d l e d \ l i b s \ d 
e b u g p y \ a d a p t e r / . . / . . \ d e b u g p y \ l a u n c h e r ' Space ' 5 7 9 5 7 ' Space ' - - ' Space ' C : \ U s e r s \ Ø y v i n d B j ø r k e l u n d \ O n e D r i 
v e Space - Space L U F T H A V N D R I F T Space A S \ D o k u m e n t e r \ P r o s j e k t e r \ P y t h o n \ L P P M \ h i l o g a m e . p y ' Space Enter

Exception:
System.ArgumentOutOfRangeException: Verdien må være større enn eller lik null, og mindre enn konsollens bufferstørrelse i den dimensjonen.
Parameternavn: left
Den faktiske verdien var -1.
   ved System.Console.SetCursorPosition(Int32 left, Int32 top)
   ved Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
   ved Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   ved Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   ved Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   ved Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)       
   ved Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   ved Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   ved Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics 
engineIntrinsics)
-----------------------------------------------------------------------
PS C:\Users\ØyvindBjørkelund\OneDrive - LUFTHAVNDRIFT AS\Dokumenter\Prosjekter\Python\LPPM>

Screenshot

debugerror

Environment data

PS Version: 5.1.19041.5007
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 107
BufferHeight: 20

Steps to reproduce

low = 1 high = 1000

print("Please think of a number between {} and {}".format(low, high)) input ("Press ENTER to start")

guesses = 1 while low != high:

print("\tGuessing in the range of {} and {}".format(low, high))

guess = low + (high - low) // 2
high_low = input("My guess is {}.\n Should i guess higher or lower?\n "
"Enter h or l, or c if my guess was correct: "
.format(guess).casefold())

if high_low == "h":
    # Guess higher. The low end of the range becomes 1 greater than the guess.
    low = guess + 1
elif high_low == "l":
    # Guess lower. The high end of the range becomes one less than the guess.
    high = guess - 1
elif high_low == "c":
    print("I got it in {} guesses".format(guesses))
    break
else:
    print("Please enter h, l or c")

guesses = guesses + 1

else: print("You thought of the number {}".format(low)) print("I got it in {} guesses".format(guesses))

Expected behavior

Debugging of a .py file

Actual behavior

The above exception happens.

github-actions[bot] commented 1 month 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.