Skip to content

Empty line before prompt, after using Clear-Host #2276

@brunovieira97

Description

@brunovieira97

Environment

PS version: 7.1.2
PSReadline version:
os: 10.0.19041.860 (WinBuild.160101.0800)
PS file version: 7.1.2.0
HostName: ConsoleHost (Windows Terminal)
BufferWidth: 110
BufferHeight: 35

Steps to reproduce

Have a prompt that spans for two lines, like:

bruno@computer in ~
❯

I've tested this on my home directory, where there are enough items for Get-ChildItem output to be vertically bigger than the Terminal's line count.

bruno@computer in ~
❯ Get-ChildItem

# Output

bruno@computer in ~
❯ Get-ChildItem

# Output

bruno@computer in ~
❯ Clear-Host

Expected behavior

Prompt is written to console and there is no scroll bar, like this:
image

Actual behavior

After two or three Get-ChildItem's (there's no exact count, except that it must be more than 1 time in a row), Clear-Host will add an extra empty line before writing the prompt to console. The cursor position, though, will be on the correct location, meaning that Windows Terminal will display a scrollbar so you can go one line up.

image

If you drag the scrollbar to the top, this is shown:
image

  • I've tested disabling PSReadLine on current session by running Remove-Module PSReadLine and everything started to work as expected.
  • Tested with ConHost, but could not reproduce the error there.
  • Tried calling Set-PSReadLineOption -ExtraPromptLineCount 1, with no effect whatsoever on console output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-ReproThere is no sufficient information on repro steps.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions