Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyboard shortcuts: wrong interpretations of special keys (e.g. [Equal] is mistaken for V) #173325

Closed
georglauterbach opened this issue Feb 3, 2023 · 31 comments · Fixed by #173456
Assignees
Labels
candidate Issue identified as probable candidate for fixing in the next release important Issue identified as high-priority regression Something that used to work is now broken verified Verification succeeded

Comments

@georglauterbach
Copy link

georglauterbach commented Feb 3, 2023

Type: Bug

  1. Update VS Code (for me, it was from 1.74.1 to 1.75)
  2. User defined keybindings using scan codes (e.g. [Equal] or [Semicolon]) are interpreted incorrectly

Screenshot from 2023-02-03 17-18-58

More details

I was literally unable to copy-paste inside VS Code because pasting was also ctrl+v..

VS Code version: Code 1.75.0 (e2816fe, 2023-02-01T15:29:17.766Z)
OS version: Linux x64 5.15.0-58-generic
Modes:
Sandboxed: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (8 x 3899)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 0, 0, 0
Memory (System) 15.57GB (11.48GB free)
Process Argv --disable-extensions --crash-reporter-id 82449883-a908-4a7a-be3e-fc9cf8042ab0
Screen Reader no
VM 0%
DESKTOP_SESSION regolith
XDG_CURRENT_DESKTOP Regolith:GNOME-Flashback:GNOME
XDG_SESSION_DESKTOP regolith
XDG_SESSION_TYPE x11
Extensions disabled

superseeds #173324



Known workarounds:

@georglauterbach
Copy link
Author

related: https://stackoverflow.com/questions/75336265/vscode-says-equal-key-is-v-keyboard-layout-messed-up

@goktan
Copy link

goktan commented Feb 3, 2023

I think this is not only ctrl+v but I have other keybindings stopped working just after this upgrade.

@georglauterbach georglauterbach changed the title keyboard shortcut: [Equal] is mistaken for V keyboard shortcuts: wrong interpretations of special keys (e.g. [Equal] is mistaken for V) Feb 3, 2023
@georglauterbach
Copy link
Author

I think this is not only ctrl+v but I have other keybindings stopped working just after this upgrade.

I adjusted the issue title accordingly. If you find out which one exactly, please let us know :)

@fernandosmither
Copy link

Seriousloy annoying. Does anybody have a quick fix? beyond losing the [Equal] keybindings or downgrading versions

@fernandosmither
Copy link

This is a rather urgent and serious bug 🤔 is there a way to give priority to this issue? @georglauterbach

@gmarsano
Copy link

gmarsano commented Feb 3, 2023

Same here. [Minus] is replaced by U and [Equal] by V. That's really annoying.

image

image

@riidom
Copy link

riidom commented Feb 3, 2023

I have an affected ctrl+equal shortcut, remapped it to ctrl+alt+equal, which stays as-is. If you need a quick workaround.

@georglauterbach
Copy link
Author

This is a rather urgent and serious bug 🤔 is there a way to give priority to this issue? @georglauterbach

I cannot adjust the issue (labels, etc.) myself, but I agree that this should have high priority.

@timoklein
Copy link

The issue has messed up a lot of my custom shortcuts and is incredibly annoying:

  • [BracketRight] is mapped to X.
  • [BracketLeft] is mapped to W.
  • [Comma] is mapped to F2.
  • [Equal] is mapped to V.
  • [Minus] is mapped to U.

These are the ones that have been affected for me from a quick glance. I'm shocked that this was released :0

@Baldomo
Copy link

Baldomo commented Feb 4, 2023

I have the same issue on VSCodium, on a US keyboard layout

Version: 1.75.0
Release: 23033
Commit: d48b950f7741008f7fb375881b45188dd73ecac4
Date: 2023-02-02T22:14:58.243Z
Electron: 19.1.9
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 6.1.6-arch1-g14-1
Sandboxed: No

Additionally, these keycodes are also broken:

  • [Backquote] is mapped to F1 but not when used with ctrl+alt+[Backquote] (that works as intended)
  • [Backslash] is mapped to Y on both IT and US layouts (I assume it's the same for all layouts then)

@georglauterbach
Copy link
Author

ping @alexdima; this should probably have high priority as broken keyboard shortcuts really cut the experience of using VS Code short

@birgersp
Copy link

birgersp commented Feb 4, 2023

I'm hoping this gets a high priority. It completely messed up a lot of my key bindings.

These are the ones that have been affected for me from a quick glance. I'm shocked that this was released :0

Released on a friday 😉 Have a nice weekend ya'll!

@vaaski
Copy link

vaaski commented Feb 4, 2023

For me on a german layout, cmd+y is cmd+# for some reason, now I can't redo anymore.

image

edit: just confirmed that this issue isn't present on 1.74.3

@M4he
Copy link

M4he commented Feb 4, 2023

For me on a german layout, cmd+y is cmd+# for some reason, now I can't redo anymore.

image

edit: just confirmed that this issue isn't present on 1.74.3

Can confirm.

Pressing [Ctrl]+[#] on the keyboard shortcut settings page with a German keyboard adds "key": "ctrl+[Backslash]" to keybindings.json. This behavior (config write) is the same on 1.74.x as well as 1.75.0. However, the interpretation of this (config read) is different:

On 1.74.x, this used to work, i.e. ctrl+[Backslash] in the config did correspond to a physical key press of [Ctrl]+[#] in the editor using a German keyboard.

However, on 1.75.0 this config entry reacts to a physical keypress of [Ctrl]+[Y] only. Thus, VSCode does not correctly interpret the keybindings.json entry it wrote itself (even if written with 1.75.0, this is not a config migration problem):

  • config write: [Ctrl]+[#] -> "ctrl+[Backslash]"
  • config read: "ctrl+[Backslash]" -> [Ctrl]+[Y]

hamzahamidi added a commit to hamzahamidi/vscode that referenced this issue Feb 5, 2023
The issue was introduced in this PR microsoft#169842
The hashcode for scan codes and simple keys was not updated to distinguish between them.

fix microsoft#173283
fix microsoft#173325
@hamzahamidi
Copy link
Contributor

Potential fix here.
The issue was introduced here.
The hashcode for scan codes and simple keys was not updated to distinguish between them.

@alexdima alexdima added the important Issue identified as high-priority label Feb 5, 2023
@alexdima
Copy link
Member

alexdima commented Feb 5, 2023

@hamzahamidi Thank you for tracking this down! This is indeed caused by the implementations of KeyCodeChord.getHashCode() and ScanCodeChord.getHashCode(), which produce strings which overlap.

For example:

  • a key code based binding like ctrl+v will have the hash code 100052.
  • a scan code based binding like ctrl+[Equal] will also have the hash code 100052.

@alexdima alexdima added regression Something that used to work is now broken candidate Issue identified as probable candidate for fixing in the next release labels Feb 5, 2023
@alexdima alexdima added this to the January 2023 Recovery 1 milestone Feb 5, 2023
@alexdima
Copy link
Member

alexdima commented Feb 6, 2023

Reopening to track the merge to stable

@alexdima alexdima reopened this Feb 6, 2023
@vscodenpa vscodenpa removed the insiders-released Patch has been released in VS Code Insiders label Feb 6, 2023
alexdima added a commit that referenced this issue Feb 6, 2023
@FernandoMiguel
Copy link

this seems to be fixed in the latest nightly

Version: 1.76.0-insider
Commit: c9e3ef865539061b5602c6b9ac6030332aa1ce70
Date: 2023-02-06T05:39:44.179Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Darwin arm64 22.3.0
Sandboxed: Yes

@Dexmaxter18
Copy link

same here [backquote] replaced by [F1]
Captura de pantalla de 2023-02-06 14-44-08
#173325

@A7mdFathi
Copy link

we can use vscode insider here as temporary replacement for stable version
bug fixes in this version and we can use settings sync to get extensions and settings from stable

@alexdima
Copy link
Member

alexdima commented Feb 7, 2023

Verification steps:

  • use Linux or macOS
  • add the following to your keybindings.json:
{ "key": "cmd+[Equal]", "command": "actions.find" }
  • Hover over cmd+[Equal]. It should not say "cmd+V for current keyboard layout".
  • Press cmd+v. It should not trigger the find widget.

@niccolomineo
Copy link

Hi, I don't mean to put pressure, but I'd like to ask how long it will take to take the fix to stable.

Thank you for your work.

@alexdima
Copy link
Member

alexdima commented Feb 8, 2023

Hi, I don't mean to put pressure, but I'd like to ask how long it will take to take the fix to stable.

We plan to release 1.75.1 tomorrow.

@aeschli
Copy link
Contributor

aeschli commented Feb 8, 2023

Verified in stable release candidate (Version: 1.75.1 Commit: 30b39f0)

@alexdima alexdima unpinned this issue Feb 10, 2023
c-claeys pushed a commit to c-claeys/vscode that referenced this issue Feb 16, 2023
…t#173456)

* fix(keybindings): fix hashcode scancode/simplekey

The issue was introduced in this PR microsoft#169842
The hashcode for scan codes and simple keys was not updated to distinguish between them.

fix microsoft#173283
fix microsoft#173325

* Avoid hash collisions between `KeyCodeChord` and `ScanCodeChord`

---------

Co-authored-by: Alex Dima <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
candidate Issue identified as probable candidate for fixing in the next release important Issue identified as high-priority regression Something that used to work is now broken verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.