Skip to content

ListView prediction breaks RevertLine() #5047

Description

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

N/A

Screenshot

Image

Environment data

PS Version: 7.5.4
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.4.5
PSReadLine EditMode: Windows
OS: 10.0.26100.7306 (WinBuild.160101.0800)
BufferWidth: 361
BufferHeight: 96

Steps to reproduce

In a pwsh -NoProfile session, run the following:

Set-PSReadLineKeyHandler -Chord "Ctrl+r" -ScriptBlock {
    [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
    [Microsoft.PowerShell.PSConsoleReadLine]::Insert("Inserted Text")
}

Set-PSReadLineOption -PredictionViewStyle ListView

Then, type foo (without pressing the enter key) and press Ctrl+R.

Expected behavior

Pressing Ctrl+R should replace foo by Inserted Text in the prompt.

Actual behavior

Pressing Ctrl+R adds Inserted Text to the existing foo: the end result is fooInserted Text in the prompt.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions