Skip to content

Can't run multi-line scriptblocks longer than console vertical buffer size with transient prompt enabled in PowerShell #3452

Closed
@DEberhardt

Description

@DEberhardt

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

[2022-10-19 13:07:39]❯ $Error[0].Exception.Message
Exception calling "InvokePrompt" with "0" argument(s): "The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -1."
[2022-10-19 13:07:57]❯ $Error[0].ScriptStackTrace
at <ScriptBlock>, <No file>: line 142
at PSConsoleHostReadLine, C:\Users\david\Documents\WindowsPowerShell\Modules\PSReadline\2.2.5\PSReadLine.psm1: line 7


### Screenshot

N/A, but easily reproducible

### Environment data

```console
PS Version: 5.1.19041.1682
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.2.5
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 171
BufferHeight: 60

and



PS Version: 7.3.0-preview.8
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.2.5
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 171
BufferHeight: 60

Steps to reproduce

I am trying to define an array of 59 users, like this:

and I get the above error.
If I paste longer text with multiple commands, this does not occur, as long as no command is longer than 50 lines for example

$UCS = @(
'sip:[email protected]',
'sip:[email protected]',
'sip:[email protected]',
[...]
'sip:[email protected]'
)
$UCS += @(
'sip:[email protected]',
'sip:[email protected]',
[...]
'sip:[email protected]'
)

Expected behavior

no keyhandler issue

Actual behavior

Command is not executed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-DuplicateThere's another issue on the tracker that's pretty much the same thing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions