atom/atom-keymap

Europatastatur gets identified as a non-latin layout

Closed this issue · 15 comments

This is Atom 1.12.5 on Win 7.

With this version keyboard shortcuts don’t work any longer as they should with german kb layout because they seem to be mapped to the position of the corresponding keys on an english kb.

Steps to reproduce:

  • with german layout enabled try to undo something with ctrl + z. Atom will try to redo something because z and y are swapped compared to english layout. So in fact, ctrl + y will undo.
  • with german layout try to comment a line with ctrl + #. This will toggle tree view instead of commenting.

Thanks for your report. I have a couple of questions.

  • Did you change keyboard layout while Atom was running?
  • Can you reproduce the problem in safe mode atom --safe?
  • There seems to be several German layouts, which one of these are you using?
    image
  • Initially I didn’t change until I searched atom issues. I tried to change layout while running and while not running and it didn’t change anything about the issue.
  • I saw the same behaviour in safe mode.
  • I’m usually using “Europatastatur” which implements the new standard layout. But then switched to Geman (Germany) to verify that it’s not that layout’s fault.

Good morning @georgd

The reason I ask for changing layouts while Atom was running is because we have fixed a bug where we didn't identify layout switches correctly while Atom was running. The fix is on master and will go out in the next hotfix release. This bug have caused similar issues.


Now to your bug report:

  • I could not reproduce the issue where all keys shortcuts were identified as US layout when I started Atom 1.12.5 with the German (Germany) layout on Windows 7. I will install the "Europatastatur" later during the day to further test this.

  • The only reason editor:toggle-line-comments is bound to Ctrl-# is because of a bug in electron. If you want to keep this shortcut for the future I recommend you bind it in your keymap.cson file. As it will be removed when this bug is fixed. By default this is bound to Ctrl-/ which is Ctrl-Shift-7 for German layout.

'atom-text-editor:not([mini])':
  'ctrl-#': 'editor:toggle-line-comments'

An additional question:

  • Did this behavior start recently? Maybe after upgrading to Atom 1.12.5? Do you have time to test the behavior in Atom 1.12.4?

Thank you, Linus, for looking into this.

  • Interesting to read about the toggle line comments. I have no problems with ctrl-/.
  • I have closely followed the development and this behaviour started only after upgrading to 1.12.5. I just verified this on a second machine going from 1.12.2 to 1.12.4 to 1.12.5.

@georgd WRT US layout and Europatastatur. I can reproduce the problem if I install this layout. As a workaround you can use Atom 1.12.4 or use the German (Germany) layout. You need to change the default input language in your operating system settings to use this layout in order for Atom to load correctly. I am sorry for the inconvenience.

@as-cii Something goes wrong when we build the layout for Europatastatur and the unmodified key for KeyS is incorrect causing Atom to believe that this is a non-latin layout. Maybe this is a bug in the Europatastatur layout?

From the latest commit in the 1.12-releases branch:
image


@georgd WRT toggle-line-comments. Both Ctrl-/ and Ctrl-# will work. The second one originates from the menu accelerator which Electron incorrectly changes depending on current input language. For Swedish layout this changes to Ctrl-'.

When you say “You need to change the default input language in your operating system settings to use this layout in order for Atom to load correctly”, do you mean Europatastatur will then work?

Hey @georgd Europatastatur will not work in Atom 1.12.5 sorry if that was unclear.

OK, thank you!

Thanks for the report, @georgd!

We have tracked down the cause of this issue. This behavior was supposed to be fixed by atom/keyboard-layout#21, where we stopped processing dead keys when generating the keymap associated with the current keyboard layout.

Unfortunately, that doesn't prevent a dead key from passing through because MapVirtualKeyEx doesn't take into account keyboard modifiers. Specifically, the Europatastatur keyboard binds AltGr+KeyR to a dead key, so when evaluating it via ToUnicodeEx it will change the global keyboard buffer. Then, when evaluating KeyS, that buffer will be flushed and ToUnicodeEx will return an extra character (¨s), causing atom-keymap to recognize KeyS as non-latin.

We will post updates to this issue as soon as we release a fix for it.

Do I understand correctly, that Atom tests for the output of the sequence of the keys AltGr+R and s to determine if the layout is latin? If so should I test on Linux if the problem exists there too ?

Do I understand correctly, that Atom tests for the output of the sequence of the keys AltGr+R and s to determine if the layout is latin?

Atom ensures that, when no modifiers keys are held down, A, S, D and F output latin characters. However it builds the entire keymap for all the keys available for the current keyboard (thus evaluating AltGrR too).

If so should I test on Linux if the problem exists there too ?

I think Linux is not affected by this issue, as it shouldn't modify the global keyboard buffer when converting key codes to characters.

I think Linux is not affected by this issue, as it shouldn't modify the global keyboard buffer when converting key codes to characters.

I use Arch Linux with German Keyboard Layout, this bug affects me too!

@eknoes Make sure you're installing from https://atom.io and not from the AUR.

@georgd Thank you for the report and apologies for the issue 🙇‍♂️ The fix for this issue has been merged and will be available in Atom 1.18.