Skip to content

Cannot define a key handler for Ctrl+B #3817

@sba923

Description

@sba923

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.3.7
PS HostName: ConsoleHost
PSReadLine Version: 2.3.3
PSReadLine EditMode: Windows
OS: 10.0.22621.2338 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 9001

Steps to reproduce

Run the code snippet in the second example of https://learn.microsoft.com/en-us/powershell/module/psreadline/set-psreadlinekeyhandler?view=powershell-7.3

Set-PSReadLineKeyHandler -Chord Ctrl+B -ScriptBlock {
    [Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
    [Microsoft.PowerShell.PSConsoleReadLine]::Insert('build')
    [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
}

Hit Ctrl+B

Expected behavior

build<enter> should be fed to the prompt

(this is what happens e.g. if -Chord F12 is used)

Actual behavior

^B is displayed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions