Skip to content

Cursor does not seem to be on the right position after resizing #682

@jianyunt

Description

@jianyunt

The cursor randomly jumps around if you resize your pwsh console. This is happening on Linux VM, cloudshell or Windows.

Initial Investigation

The issue seems to come from here https://github.com/lzybkr/PSReadLine/blob/master/PSReadLine/Render.cs#L636. RecomputeInitailCoords() checks BufferWidth only. I am not sure the original design intent. However If I add BufferHeight in the RenderData class and check the BufferWidth in the RecomputeInitailCoords(). The problem goes away.

Steps to reproduce

  1. Linux VM or CloudShell bash + pwsh

  2. ls -la

  3. If you make the console smaller, you will see a large space added before the current line
    image
    image

  4. make the console bigger, you will see your cursor jump in the middle of the console.

image

Expected behavior

The cursor should remain the same position as pre-resizing.

Actual behavior

See above.

Environment data

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.1
PSEdition                      Core
GitCommitId                    v6.1.0-preview.1
OS                             Linux 4.4.0-121-generic #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

cc @SteveL-MSFT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions