The VI-mode commands f' , f" , t' and t" insert ' or " instead of moving the cursor when running on Windows when using the International Layout (dead keys)

Open
#3,795 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, shell

Research direction

Start by reproducing the bug in PSReadLine's Vi-mode f/F/t/T commands on Windows with the United States-International keyboard layout, comparing it with the US layout and WSL2 behavior. Trace the Windows input handling for dead keys, then verify that pressing the dead key followed by Space moves to the requested character without ringing the bell or inserting it.

Written by the indexing model from the issue text.

Description

Issue-Bug Needs-More Investigation VI-Mode
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

PowerShell VI Mode Windows bug
Print showing that when I try to use F" or F' it prints the character instead of moving the cursor to the previous ocurrence of the character.

Environment data
PS Version: 7.2.13
PS HostName: ConsoleHost
PSReadLine Version: 2.2.6
PSReadLine EditMode: Vi
OS: 10.0.19041.320 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 9001
Steps to reproduce

(The following steps can be made replacing ' for " or `)

  • Set the Windows language layout to United States-International
  • Write anything with an ' on it on PowerShell
  • Press ESC to go the VI-mode's normal mode
  • Try to move to the written character with f' or t' (or if the character is to the left of the cursor with F' or T')

(the key here is used to send the ' key directly instead of merging it with another key since in this layout it's a dead key)

Expected behavior

The cursor should move to the desired character, exactly like it happens on the US layout (the only difference should be the need to press space after ' or " or `).

Actual behavior

When running it on WSL2 it works exactly as expected - since it's a dead key on US International Layout when I press f " it waits the next key and if I press space (to insert the " character) it searches for next ocorrence of the " character. But when running on Windows it doesn't seem to recognize the dead key and fails the command as soon as I press any of it.

I've noticed it sends a bell as soon as I press the dead key (if I press d f and then ' as soon as the ' is first pressed it sounds the bell), which I believe indicates that the previous command failed/was cancelled and then when I press space it prints the character (if I press the same accent again it prints it twice) which would be the expected behaviour if I was on insert mode and not chaining commands on normal mode.

I've made tests with the US keyboard layout and it works fine. Also, some accented words like à or á (that are written with the keys a backtick and a ' trigger the same behavior, just printing the character instead of moving the cursor.

As an additional info the ^ key is also a dead key on this layout but has a different behaviour - it doesn't ring any bell, and when chained to command it just ignores the command and goes to the start of the line (the expected behaviour when the command is like d^ would for it to delete until the start of the line, not just go there).

I've also made many tests like using Windows Terminal or conhost and using both PowerShell 5 and PowerShell 7 versions (with the latest preview of PSReadLine). So far it only happens on Windows and when using the United States-Internatial layout (which is the one I use to be able to write both english and portuguese on my ANSI layout keyboard)

Dominant language
C#
Stars
4.4k
Forks
341
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PowerShell/PSReadLine

All issues in PowerShell/PSReadLine

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.