Skip to content

Multi-line prompt triggers exception #843

Closed
@perennialmind

Description

@perennialmind

Environment data

PSReadline version: 2.0.0-beta3
os: 10.0.17134.1 (WinBuild.160101.0800)
PS file version: 6.1.0

Steps to reproduce or exception report

Define a multi-line prompt, with embedded linebreak of "`n", "`n`r", or [System.Environment]::NewLine. Start typing pretty much anything. if will do. Calling Set-PSReadlineOption -ExtraPromptLineCount 1 before or after did not affect the outcome.

PS C:\> Set-PSReadlineOption -ExtraPromptLineCount 1
PS C:\> function prompt { "[$(Get-Location)\]`n`r$("+"*(Get-Location -Stack).Count)>" }
[C:\\]
>i

Oops, something went wrong. Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new

Last 82 Keys:

 f u n c t i o n Space p r o m p t Space { Space " [ $ ( G e t - L o c a t i o n ) \ ] ` n ` r $ ( " + " * ( G e t - L o c a t i o n Space - S t a c k ) . C o u n t ) > " Space } Enter
 i f

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, CancellationToken cancellationToken)

[C:\]

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