Skip to content

Input issue when setting custom prompt #849

Closed
@neur0manc

Description

@neur0manc

Environment data

PS version: 6.1.2
PSReadline version: 2.0.0-beta3
os: Linux amygdala 4.19.13-300.fc29.x86_64 #1 SMP Sat Dec 29 22:54:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
PS file version:

Steps to reproduce or exception report

  • Set custom prompt function (see below)
  • Type " in prompt
  • Receive error message below

Details

(I removed a backtick from tripple backticks in the error message)

PS /home/stephan> function prompt { $p = Get-Location ; "$env:HOSTNAME ($p)>`n" }
amygdala (/home/stephan)>

amygdala (/home/stephan)>

amygdala (/home/stephan)>
uname
Linux
amygdala (/home/stephan)>
uname -a
Linux amygdala 4.19.13-300.fc29.x86_64 #1 SMP Sat Dec 29 22:54:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
amygdala (/home/stephan)>
clear
amygdala (/home/stephan)>

amygdala (/home/stephan)>

amygdala (/home/stephan)>

amygdala (/home/stephan)>

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 164 Keys:
``
 " " LeftArrow $ e n v : h o s t n a m e Enter
 $ e n v : h o s t n a m e Enter
 G e t - C h i l d i t e m Backspace Backspace Backspace Backspace I t e m Space Backspace Tab Backspace Tab Tab Backspace Backspace Backspace Backspace i t e m Tab Space E n v : Enter
 UpArrow UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace H O S T N A M E Enter
 UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow G Backspace $ e n v : H O S
T N A M E Space RightArrow RightArrow RightArrow RightArrow Enter
 Enter
 Enter
 u n a m e Enter
 u n a m e Space - a Enter
 c l e a r Enter
 Enter
 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: 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.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, CancellationToken cancellationToken)
``
-----------------------------------------------------------------------
amygdala (/home/stephan)>

Metadata

Metadata

Assignees

No one assigned

    Labels

    OutOfRangeIssues relating to System.ArgumentOutOfRangeException

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions