PowerShell / PSReadLine

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

System error after using Compare method in java in VSCode #3717

Closed damullutkid closed 1 year ago

damullutkid commented 1 year ago

Prerequisites

Exception report

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 -1.
   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(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

N/A

Environment data

PS Version: 5.1.19041.3031
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 170
BufferHeight: 11

Steps to reproduce

package CodingPractice; import java.util.Comparator;

public class GPAComparator implements Comparator{

@Override
public int compare(Student o1, Student o2) {
    return Double.compare(o1.getGPA(), o2.getGPA()); //Keep in mind the c

}

public static void main(String[] args) {
    Student s1 = new Student("Jesus", 2.5);
    Student s2 = new Student ("Jose", 3.0);

    System.out.println(new GPAComparator().compare(s1, s2));
    System.out.println(new GPAComparator().compare(s1, s2));
}

}

Expected behavior

Print out -1 in terminal

Actual behavior

Exception thrown

github-actions[bot] commented 1 year ago

This issue was already fixed (see #1306). Please upgrade to the 2.2.6 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.