Skip to content

Dynamic help rendering behaves incorrectly when buffer scrolling is required #2950

@daxian-dbw

Description

@daxian-dbw

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

No exception, but the rendering is incorrect.

Screenshot

As is shown in the GIF below, the cursor position is off when the dynamic help rendering needs buffer scroll-up.
This is because when it comes to adjust the cursor position, the code doesn't take into account the extra physical lines introduced by multi-line text.

Animation

Environment data

PS Version: 7.1.3
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.2.0-beta4
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 133
BufferHeight: 30

Steps to reproduce

  1. Type a number of Enter to move the prompt to the last line of the screen buffer.
  2. Copy get-Command -Name to the line
  3. Press Alt+h to trigger the dynamic in-line help
  4. Press any key to clear the content, and then press Alt+h again.

You will see the cursor position becomes incorrect.

Expected behavior

Cursor position should be at the end of get-Command -Name

Actual behavior

Cursor position becomes incorrect.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions