Skip to content

Windows Terminal 1.1 breaks remapped CapsLock key inside WSL #7120

@christianfosli

Description

@christianfosli

Environment

Windows build number: Microsoft Windows [Version 10.0.18363.959] (1909)
Windows Terminal version (if applicable): 1.1.2021.0

Any other software? PowerToys v0.19.2, Ubuntu 20.04 WSL fresh install from Microsoft Store with no custom config

Steps to reproduce

  • In Windows PowerToys, map "Caps Lock" key to "Ctrl" (left or right doesn't matter)
  • Open Ubuntu WSL in Windows Terminal
  • Open Vim or Neovim, go into Insert mode
  • Press "Caps Lock" (which is mapped to "Ctrl")

Expected behavior

"Caps Lock" should be treated as "Ctrl". No visible result.

Actual behavior

"Caps Lock" is treated as "Control-Space", and tries insert any previously inserted text again.


Work-Around

The issue goes away by adding this to settings.json

"experimental.input.forceVT": true,

Therefore it is likely caused by #6309

More Details, Debugging info

I originally thought it was a bug in PowerToys, but since the work-around works, I figure the bug must be here.
It's a bit annoying, because I like to escape out of normal mode in vim by pressing <CapsLock>-[ (which should be treated as <Ctrl>-[, which is again treated as <esc>). Now I instead insert the text i wrote twice.

If i input <Ctrl-V><Caps-Lock> in Vim insert mode, vim inserts <C-Space>. This is how I determined the remapped key is interpreted as <C-Space>.

  • This happens only inside Windows-Subsystem for Linux (WSL1) inside windows terminal
  • I tested with a new installation of Ubuntu from the Microsoft Store, with no customizations to Ubuntu, Vim or wslconf
  • I tested inside and outside of tmux, which did not make any difference
  • The issue is not present running WSL from CMD or Powershell, i.e. not using windows terminal.
  • The issue is not present running Neovim directly from Powershell Core inside windows terminal
  • The issue is not present running vim in Linux (tested Alpine) inside windows terminal as a Docker container

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Tag-FixDoesn't match tag requirementsNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meetingResolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions