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

Some Ctrl+Alt+ shortcuts no longer work when AltGr+ is pressed #68787

Closed
Gooseman opened this issue Feb 15, 2019 · 49 comments · Fixed by #168607
Closed

Some Ctrl+Alt+ shortcuts no longer work when AltGr+ is pressed #68787

Gooseman opened this issue Feb 15, 2019 · 49 comments · Fixed by #168607
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders keybindings VS Code keybinding issues verification-needed Verification of issue is requested verified Verification succeeded windows VS Code on Windows issues
Milestone

Comments

@Gooseman
Copy link

I have several shortcuts defined using Ctrl+Alt+. The ones that have a vowel no longer execute the shortcut, but instead insert an accented character. This started with the latest update -

Version: 1.31.1 (user setup)
Commit: 1b8e830
Date: 2019-02-12T02:20:54.427Z
Electron: 3.1.2
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 6.1.7601

The keyboard shortcuts that no longer work
{
"key": "ctrl+alt+e",
"command": "cursorLineEnd",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+a",
"command": "cursorLineStart",
"when": "editorTextFocus"
},

I've tried this with extensions disabled and in insiders and the result is the same. When I try to add the shortcut using the "Define Keybinding" button, when I type the 'e', the Ctrl and Alt disappear from the editor and only the 'e' is left. The language set in the OS has not changed, nor has the keyboard setup - standard UK keyboard.

How do I restore the shortcuts and remove the accented characters?

Thanks
Craig

@vscodebot vscodebot bot added the keybindings VS Code keybinding issues label Feb 15, 2019
@kieferrm
Copy link
Member

@Gooseman This happens on the right Alt key? Or on both?

@Gooseman
Copy link
Author

Gooseman commented Feb 16, 2019 via email

@richard-scott
Copy link

I have the same problem with the PlatformIO extension. It uses CTRL+ALT+u to upload code to an Arduino. On my old laptop this works (outside of the App I get ú when I press those keys, but in the app, the shortcut takes precedence.

On a fresh install of Windows 10 Pro, with a fresh install of VS Code, and the PlatformIO extension I get ú when I press the shortcut keys.

On the OS that works, I have v10.0.17134, and the one that doesn't work has v10.0.17763. All other apsects of VS Code are exactly the same as in the original post

@leandro86
Copy link

I also have the same problem: the right CTRL+ALT keys doesn't work for a shortcut. It works if I press the left CTRL+ALT keys.

@Gooseman
Copy link
Author

Gooseman commented Feb 17, 2019 via email

@richard-scott
Copy link

It seems to be the shortcuts that would have inputted a unicode character that now fail.
Such as:

CTRL+ALT+o = ó
CTRL+ALT+a = á
CTRL+ALT+o = é
CTRL+ALT+u = ú

However, CTRL+ALT+u is a short cut for "upload" with the PlatformIO extension.

On a different (older) Windows 10 install with VS Code, the shortcut works, but on a fresh install -completed in the last couple of days - the shortcut doesn't work, and the unicode character overrides it.

@Gooseman
Copy link
Author

Gooseman commented Mar 8, 2019 via email

@richard-scott
Copy link

I've had to write a new windows keyboard map to get round this ;-(

On here it suggests this procedure to create a new keyboard layout.

  1. Download The Microsoft Keyboard Layout Creator. It is a simple tool that lets you modify your keyboard layout. (Download link)

  2. Open to tool and File -> Load Existing Keyboard and choose your keyboard layout.

  3. Select File -> Save source as and give it a new name.

  4. Tick the Alt+Ctrl (AltGr). You might want to select File -> Save as Image to make a note of the original assignments.

  5. Remove all assigned keys, by clicking them, deleting the symbol, and click OK. Do not clear any dead keys! (The grey ones). Check for all modifiers i.e. AltGr, Ctrl, Alt, or none!

  6. Go to Project -> Properties and give it a decent name and description.

  7. Save it: File -> Save Source File so you can edit it later

  8. Export setup: Project -> Build DLL and Setup Package

Then we need to apply this new keyboard layout.

  1. Find the exported setup files in you Documents folder, and double click setup.exe. This will install your new keyboard layout.
  2. Open the input setting by going to Control Panel -> Change keyboards and other input methods -> Change keyboards.
  3. Click Add select you own keyboard and make it default.

@entozoon
Copy link

entozoon commented Oct 5, 2019

Intricate solution @richard-scott, but perhaps a little bit of overkill..
For example, with the Platformio issue, you could just re-assign the keyboard shortcut to ctrl-alt-y or whatever.
Publishing a plugin with a shortcut always comes with the risk of OS incompatibility for one daft reason or another

@brunorodriguesdecarvalho

My problem was related to run MySQL queries inside VSCode, by pressing ctrl + alt + E. My solution was to change the keyboard shortcut from ctrl + alt + E to ctrl + alt + backspace, which is easier to type. =]

I followed the instructions on this video (image): https://cloud.githubusercontent.com/assets/5047891/25484174/38f5b004-2b59-11e7-994b-dfa96ef043ce.gif

@rebornix rebornix added the bug Issue identified by VS Code Team member as probable bug label Oct 22, 2019
@CanisLupus
Copy link

This issue is still happening as of today (i.e. using shortcuts like Ctrl+Alt+Aor Ctrl+Alt+E inserts á and é). I'm using the "United Kingdom Extended keyboard" layout in Windows.

What is strange is that I have the same exact layout in a different computer, and this problem does NOT happen there. Is this something that can be fixed/broken by a Windows update? I currently have no clue about what could fix this.

VSCode info;

Version: 1.41.1 (user setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362

@nishnat-rishi
Copy link

This doesn't seem to be a VS Code issue. Rather, Windows seems to have made it a bit easier to input regional Unicode characters. Any sort of 'extended' or 'international' version of the keyboard will reproduce this issue with specific characters. Just change keyboard layout to 'US' or 'United Kingdom' to at least have access to non-vowel shortcuts.

Steps to fix consonants:

  • Go to 'Advanced keyboard settings'. Ensure the drop-down menu option under 'Override for default input method' is set to 'Use language list (Recommended)'.
  • Go to 'Language settings', Make sure under 'Preferred languages', first option is set to 'English (United States)'. or 'English (United Kingdom)' Click on it. Click on 'Options'.
  • Under 'Keyboards', remove whatever keyboard is there, and add 'US' or 'United Kingdom' keyboard instead.

At least the consonants should be fixed now.

@Gooseman
Copy link
Author

Gooseman commented Jan 31, 2020 via email

@moluoyu
Copy link

moluoyu commented Mar 16, 2020

it's 2020 3.7 .it has the same question.

Version: 1.43.0 Commit: 78a4c91400152c0f27ba4d363eb56d2835f9903a Date: 2020-03-09T19:44:52.965Z Electron: 7.1.11 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Linux x64 5.3.0-40-generic snap

@Lucide
Copy link

Lucide commented Mar 18, 2020

Other programs, like CLion, are able to discern between Ctrl+Alt and AltGr, VSCode should do the same.
Being unable to reach shortcuts because of the keyboard layout is a bug, and changing it isn't really a solution. The layout is there to write, a text editor is exactly where I would want to use it.

@colski
Copy link

colski commented Jun 3, 2020

Just to add this problem is biting me too - almost certain it is caused by a windows update / rebuild... I am now on version 1909, (build 18363.836)

thx.

@ank1traj
Copy link

ank1traj commented Jun 4, 2020

This issue is still happening as of today (i.e. using shortcuts like Ctrl+Alt+Aor Ctrl+Alt+E inserts á and é). I'm using the "United Kingdom Extended keyboard" layout in Windows.

What is strange is that I have the same exact layout in a different computer, and this problem does NOT happen there. Is this something that can be fixed/broken by a Windows update? I currently have no clue about what could fix this.

VSCode info;

Version: 1.41.1 (user setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362

Just change your keyboard to US layout. It works for me.

@Gooseman
Copy link
Author

Gooseman commented Jun 4, 2020 via email

@colski
Copy link

colski commented Jun 5, 2020

Just change your keyboard to US layout. It works for me.

well that's a work around, thanks for mentioning it.

@atifraza
Copy link

Nishnat-Rishi - I haven't seen anyone complaining about problems with consonants, only vowels. The problem is not related to the keyboard layout. I don't switch my keyboard layout and sometimes when I use a key combination that includes Ctrl, Alt and a vowel I don't get the shortcut I've configured, but rather an accented vowel.

I can confirm this problem with consonants. For example, on a US International keyboard Ctrl+K Ctrl+Alt+S does not work if the right Alt key is used.

@lfdversluis
Copy link

I see this is still open. Any ETA on a fix? I use InteliJ's shortcuts and ctrl + alt + L to format a file ends up inserting an ø...

@TheEpicFace007
Copy link

I amhaving the issue aswell. I tried what @nishnat-rishi said here but it didn't worked out.

@kebbleytea2
Copy link

kebbleytea2 commented Sep 4, 2020

I amhaving the issue aswell. I tried what @nishnat-rishi said here but it didn't worked out.

This is the same for me, I have also tried this. I am unable to bind CTRL + ALT + UP and the same with CTRL + ALT + DOWN.
It works with numpad up & down keys though.

Would be nice to see a solution to this!

Although I'm not entirely sure if my issue is related, might not be 🤔. I can bind UP + DOWN separately, but not when using CTRL + ALT

@adam-stamand
Copy link

I amhaving the issue aswell. I tried what @nishnat-rishi said here but it didn't worked out.

This is the same for me, I have also tried this. I am unable to bind CTRL + ALT + UP and the same with CTRL + ALT + DOWN.
It works with numpad up & down keys though.

Would be nice to see a solution to this!

Although I'm not entirely sure if my issue is related, might not be 🤔. I can bind UP + DOWN separately, but not when using CTRL + ALT

I'm having the exact same issue as @KebbleyTea. I can bind UP and DOWN separately, but I can't bind then when using CTRL+ALT.

@TheEpicFace007
Copy link

I noticed the issue also happened in visual studio. I think it's not related to vs code. It somehow got fixed after the latest windows update.

@hugoblanc
Copy link

I amhaving the issue aswell. I tried what @nishnat-rishi said here but it didn't worked out.

This is the same for me, I have also tried this. I am unable to bind CTRL + ALT + UP and the same with CTRL + ALT + DOWN.
It works with numpad up & down keys though.
Would be nice to see a solution to this!
Although I'm not entirely sure if my issue is related, might not be 🤔. I can bind UP + DOWN separately, but not when using CTRL + ALT

I'm having the exact same issue as @KebbleyTea. I can bind UP and DOWN separately, but I can't bind then when using CTRL+ALT.

Facing the same problem, but LEFT and RIGHT are also affected

@LouDnl
Copy link

LouDnl commented Apr 6, 2022

Had this exact issue today all of a sudden, everything worked fine yesterday. I assigned the key combination ctrl + alt + shift + n to the shortcut to open a new window with a copy of the workspace and this and some Calva shortcuts didn't work didn't work anymore today. Instead of the assigned shortcut the Windows keyboard shortcut activated and printed the special character assigned to it on screen.
e.g. ctrl+alt+c ctrl+alt+j would give © and ctrl+alt+shift+n would give Ñ.
Changing my keyboard layout to US Keyboard instead of United-States International keyboard solved it.

Still an issue that it worked fine yesterday on the United States-International keyboard layout and today it doesn't.
Here's the logs from the keyboard shortcuts troubleshooting output window with the above keyboard layout:

CTRL + ALT + SHIFT + N

[2022-04-06 13:46:20.566] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
[2022-04-06 13:46:20.567] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
[2022-04-06 13:46:20.567] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2022-04-06 13:46:20.751] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl,shift], code: ShiftLeft, keyCode: 16, key: Shift
[2022-04-06 13:46:20.751] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl,shift], code: ShiftLeft, keyCode: 4 ('Shift')
[2022-04-06 13:46:20.751] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2022-04-06 13:46:20.879] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl,shift,alt], code: AltLeft, keyCode: 18, key: Alt
[2022-04-06 13:46:20.879] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl,shift,alt], code: AltLeft, keyCode: 6 ('Alt')
[2022-04-06 13:46:20.879] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2022-04-06 13:46:21.343] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [shift], code: KeyN, keyCode: 78, key: Ñ
[2022-04-06 13:46:21.343] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [shift], code: KeyN, keyCode: 44 ('N')
[2022-04-06 13:46:21.343] [renderer1] [info] [KeybindingService]: | Resolving shift+N
[2022-04-06 13:46:21.343] [renderer1] [info] [KeybindingService]: \ No keybinding entries.
[2022-04-06 13:46:21.614] [renderer1] [info] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.

CTRL + ALT + C CTRL + ALT + J

[2022-04-06 13:47:06.782] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 17, key: Control
[2022-04-06 13:47:06.783] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl], code: ControlLeft, keyCode: 5 ('Ctrl')
[2022-04-06 13:47:06.783] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2022-04-06 13:47:06.886] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl,alt], code: AltLeft, keyCode: 18, key: Alt
[2022-04-06 13:47:06.887] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl,alt], code: AltLeft, keyCode: 6 ('Alt')
[2022-04-06 13:47:06.887] [renderer1] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2022-04-06 13:47:07.086] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [], code: KeyC, keyCode: 67, key: ©
[2022-04-06 13:47:07.087] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [], code: KeyC, keyCode: 33 ('C')
[2022-04-06 13:47:07.087] [renderer1] [info] [KeybindingService]: | Resolving C
[2022-04-06 13:47:07.087] [renderer1] [info] [KeybindingService]: \ From 1 keybinding entries, no when clauses matched the context.
[2022-04-06 13:47:07.806] [renderer1] [info] [KeybindingService]: / Received  keydown event - modifiers: [ctrl,alt], code: KeyJ, keyCode: 74, key: j
[2022-04-06 13:47:07.807] [renderer1] [info] [KeybindingService]: | Converted keydown event - modifiers: [ctrl,alt], code: KeyJ, keyCode: 40 ('J')
[2022-04-06 13:47:07.807] [renderer1] [info] [KeybindingService]: | Resolving ctrl+alt+J
[2022-04-06 13:47:07.807] [renderer1] [info] [KeybindingService]: \ No keybinding entries.
[2022-04-06 13:47:08.030] [renderer1] [info] [KeybindingService]: + Ignoring single modifier ctrl due to it being pressed together with other keys.

@alexdima
Copy link
Member

alexdima commented Apr 7, 2022

@LouDnl The problem on macOS where certain special characters are always inserted despite being bound to a keybinding is tracked at #41024 . It reproduces with multiple keyboard layouts, including US Intl. The issue has been reported upstream.

@erikvullings
Copy link

Turn on the NumLock. Worked for me!
As @hhendrikk suggested, I also needed to turn the numeric keylock on to make it work. However, as my keyboard doesn't have a numeric keypad (same as @Gooseman ), it wasn't so simple to turn it on. I basically followed this video, so go to WINDOWS Settings | Ease of Access | Keyboard menu item | Use the On-Screen Keyboard.
image

When the On-Screen keyboard is open, go to Options | Turn on numeric key pad | Num Lock.
image

That's all...

@adam-grant-hendry
Copy link

I gave up on this. I don't know what the heck is going on. I just replaced "Add Cursor Above/Below" with "Ctrl+Shift+UpArrow/DownArrow"...so annoying.

@Mardenf
Copy link

Mardenf commented Jul 24, 2022

**erikvullings ** commented on 16 Jun

Thanks a lot!!! It Worked for me!!!!

@LouDnl
Copy link

LouDnl commented Sep 30, 2022

It is caused by the keyboard layout language. I fixed it for myself by making sure I use 'US English' layout when working in VSCode.
If and when they do not work it's 95% of the time caused by using the wrong keyboard layout.
For some reason, which I cannot explain, it doesn't always stop working when on another layout 🤷🏻‍♂️
Switching keyboard layout is as easy as pressin windows key + spacebar.

@alexdima alexdima changed the title Some Ctrl+Alt shortcuts no longer work Some Ctrl+AltRight+ shortcuts no longer work Dec 9, 2022
@alexdima
Copy link
Member

alexdima commented Dec 9, 2022

Trying to summarise what I know on this topic:

  • this behavior depends on the keyboard layout.
  • under some keyboard layouts, like the US-International keyboard layout, the right Alt key becomes AltGr.
  • Wikipedia does a great job explaining what is the purpose of this new modifier.
  • AltGr is a completely separate modifier key than Alt.
  • for example, when using the US-International keyboard layout:
    • Alt+c (i.e. AltLeft + c) produces no text
    • AltGr+c (i.e. AltRight + c) produces ©.
  • we are built with Electron, which is built with Chromium, and we dispatch keybindings based on the keyboard events we receive from Chromium. Under Windows we use the .keyCode, .ctrlKey, .shiftKey, .altKey properties on the keydown event to dispatch our keybindings.
  • When pressing AltGr+c, Chromium would send an event for C, with the modifiers .ctrlKey: true and .altKey: true.
  • This is what allowed that in past versions of VS Code, a keybinding for Ctrl+Alt+E could be triggered by pressing:
    • AltGr+E (i.e. AltRight + E)
    • Ctrl+AltGr+E (i.e. Ctrl + AltRight + E)
    • Ctrl+Alt+E (i.e. Ctrl + AltLeft + E)
  • Chromium has changed this in version 67 and now no longer set e.ctrlKey and e.altKey to true when pressing AltGr.
  • This Chromium change reached VS Code with the 1.31 update documented here.

@alexdima alexdima changed the title Some Ctrl+AltRight+ shortcuts no longer work Some Ctrl+Alt+ shortcuts no longer work when AltGr+ is pressed Dec 9, 2022
@alexdima alexdima added feature-request Request for new features or functionality and removed upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Dec 9, 2022
@alexdima alexdima added this to the January 2023 milestone Dec 9, 2022
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Dec 9, 2022
@roblourens roblourens added the verification-needed Verification of issue is requested label Jan 24, 2023
@bhavyaus bhavyaus added verification-steps-needed Steps to verify are needed for verification and removed verification-needed Verification of issue is requested labels Jan 25, 2023
@rzhao271 rzhao271 added verified Verification succeeded verification-needed Verification of issue is requested and removed verification-steps-needed Steps to verify are needed for verification labels Jan 25, 2023
@rzhao271
Copy link
Contributor

I verified that the keyboard shortcuts in #68787 (comment) work again for the US-International layout after keyboard.mapAltGrToCtrlAlt was enabled.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders keybindings VS Code keybinding issues verification-needed Verification of issue is requested verified Verification succeeded windows VS Code on Windows issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.