atom / atom-keymap

Atom's selector-based keymap system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some non-US keyboard layouts not working

nshtg opened this issue · comments

Regarding: atom/atom#2600
@kevinsawicki

Compare US and (for example)
800px-kb_us-international svg

German keyboard layout
800px-kb_germany svg

I think its easy to see why src/helpers.coffee is destined to fail horribly.

One example to demonstrate: I try to Toggle comments using Ctrl-/. For that I would have to press Ctrl-Shift-7 as you can see above. It registers Ctrl-?.

I don't know how, but your script somehow catches my Ctrl-Shift-7 (which would be shift+55) and makes it an ? (191) where it should make it an &.

Edit: What is that; If I press # on my keyboard it gets resolved to 3 in the keybinding resolver, but inserted correctly into the text. Something is very very wrong here! 😱

Regarding that ChromeBug you told us about; It seems like it is only relevant on keydown (show 191).

keypress returns the correct value 47 for my call! Why are you using keydown in favor of keypress?

The keypress event doesn't include modifier key information if I recall correctly.

Ups, I did not mean to delete. Yes indeed keypress supplies the modifier key information but it does not get triggered unless there is a key to insert. For example Ctrl-Shift-7 will not insert anything because it does not press a key - Only Shift-7 does.

But using keydown to map characters (the existing keybindings) to the user input is not really easy or straightforward I think. This guy explains it pretty good:

http://www.javascripter.net/faq/onkeypress.htm

Unlike event.keyCode of keydown/keyup events, the character codes in keypress events reflect the actual characters the user typed (and not necessarily the keys pressed). The characters may be capital or small, Latin or locale-specific. For example, depending on the current state of the client, the F key on the keyboard may produce a capital Latin letter F, a small Latin letter f, a capital Cyrillic letter A, a small Cyrillic letter a, or any other character that might be mapped to this particular key – quite a few different characters with their own character codes. Therefore, we must use the keypress event here; should we use keydown, we would get the same key code 70 (F) for all of the above.

So do you see any way of dealing with this other than lobbying Chromium to fix the underlying issues? This stuff gets confusing quickly.

On an international layout, what are the expectations for key bindings. For example, in the Greek layout they expect unmodified keystrokes to insert Greek characters, but they expect keystrokes with modifier keys to fall back to the ASCII equivalents.

@nathansobo
I spent the past days reading through everything on jQuery/javascript key handling that I could find, and no, I think except for lobbying chrome there's nothing we can do. But I don't have too high expectations, I remember another crucial bug that was open for almost 7 years and no one even remotely cared.

It's not implemented in Chromium yet, but the DOM Level 3 keyboard event spec should give us exactly what we need with the KeyboardEvent.key property. It's partially implemented in Chromium and is being tracked by this issue. It looks like some of the properties have been implemented but we're still waiting on key.

I saw that, yep. Let's hope they do it in the near future, but there hasn't been activity for almost a year.
😕

commented

Ubuntu 14.04, German keyboard layout, Keybinding resolver "correctly" gave Ctrl+& when I tried to press Ctrl+Shift+7 to toggle comments. It does not work, I have to press Ctrl+# (corresponds to the US layout's '/').

Thanks to the issue it's easy to figure out which keys to use and to understand why "native!" keys work according to my keyboard layout while others don't. If this issue remains open for long (depending on Chromium), I wonder if it's possible to give feedback about the situation in the Settings window - e.g. configuring my native layout and displaying its keystroke in a column next to the current Keystrokes.

How is this possible that they ignore there are keyboards out there that are not US keyboards?
This it the type of things that make Atom unusable or at least not fully usable for so many people, isn't there a way to deal with it internally?
Thank you!

Regarding the german keyboard layout: maybe this is obvious for some people, but this is only one possible german keyboard layout. At least the german mac keyboard layout is different than the one on the image. I'm not sure if the e.g. US win/mac keyboards differ as well.

@andersennl that's true. For example I am using the german Neo2 Layout. Most of the usual characters like = and : and so on are not working in Atom (Mac OS X) 😢

I don't know if this is the same bug but I can't unbind the | key. Right now it folds any text tree but I need to use that key for haskell :(

@jannickj Can you paste the expression you're using to unbind?

@nathansobo thanks, and sorry I didn't update my comment, I found out the correct key to unbind using the atom keybind resolver.

apparently unbinding ctrl-alt-[ did the trick to unbind altgr-|
'atom-workspace atom-text-editor:not([mini])':
'ctrl-alt-[':'unset!'

Maybe this could help,
i've released a package that tries to fix all the keyboard-localization stuff: https://github.com/andischerer/atom-keyboard-localization

There is a keymap translation table generator included for fast generation of foreign keyboard maps which can be used by the package. A german key translation map is already included.
Feel free to check it out ;)

a new update of atom, has made it so unsetting it on my own options does not effect it. I have to manually go into
...\AppData\Local\atom\app-0.183.0\resources\app\keymaps\win32.json
and delete

"ctrl-alt-[": "editor:fold-current-row",

if i want to have "|"
every single time a new update of atom comes out (which is quite often)

this is annoying me to no end, can we please just have fold-current-row removed from the keymap until the issue is resolved? :)

this is annoying me to no end, can we please just have fold-current-row removed from the keymap until the issue is resolved? :)

This makes everyone who doesn't have this issue (the majority of Atom users) suffer. Have you tried out @andischerer's package to see if that helps?

To my knowledge, nothing we've changed recently should affect the ability to unset! a binding. Might be worth investigating and filing an issue.

Hmm.. maybe I am not using it correctly
in my keymap.cson i have tried to set

'atom-workspace atom-text-editor:not([mini])':
     'ctrl-alt-[': 'unset!'

but the folding still happens but it just also adds "|" to where my text-cursor is

@50Wliu oh well was worth a try :p
anyway i did try the package didn't fix it

This quickfix worked for me (danish layout):
#35 (comment)

On version 0.188.0 using andischerer's keyboard-localization plugin all seems to work fine

Coming here from atom/tree-view#457 . Atom suggests to use Ctrl-\ to toggle the tree view. Inaccessible because I already need to press AltGr (= Alt + Ctrl) to enter "" alone.

My proposal was to switch the primary & secondary key binding (Ctrl-K Ctrl-B) of this action for wider audience.

This is so nasty. I updated from .182 to .208 , to find out that I can not write Greek any more (the characters appear as spaces). Good thing I had kept the old binary. (kubuntu 14.04 64 bit).

@stavpup That sounds like a different issue. @izuzak have you heard about anything like this?

That sounds like a different issue. @izuzak have you heard about anything like this?

@nathansobo Hmmm, not sure. Maybe it's related to atom/atom#6214 ? @stavpup Can you check that issue, especially the comments related to changing your font?

I run "atom --safe" and greek characters appear normal. So it must be a package that causes the problem, but which one(s)?

@stavpup You should be able to figure that out by disabling packages one by one.

I got it, its the package https://github.com/braver/fonts

No progress on this issue for about a year now...
What about upvoting the related issue in Chromium and promoting this problem further?

commented

There are other issues on Android for example that are pretty high priority with thousands of comments and google still does not care since more than a year.

+1

I can't write a backspace in atom.io. Which makes it sort of unusable.

Using https://github.com/andischerer/atom-keyboard-localization solved the problem for me.

This should not say "Foreign". That is bad grammar, bad taste, bad style. It should say "International" or "Non-U.S. English"

@uchuugaka You're absolutely right, and I appreciate you pointing this out. I've renamed the issue in a less USA-centric fashion and hope you'll forgive the original title.

Had the same problem with ctrl-shift-7 (was shown as ctrl-& instead of ctrl-/ in the keyboard inspector) with 1.0.2 under ubuntu 14.04. Using https://github.com/andischerer/atom-keyboard-localization with de layout solved it.

I've downloaded the keyboard-localization package. Where I'm supposed to place it so I can install it? This is my first day trying Atom.

@maduron Also take a look at the Atom Flight Manual - it's a complete guide for those starting out with Atom. In particular you may want to look at https://atom.io/docs/latest/using-atom-atom-packages

Thanx, friends @andischerer , @mnquintana ... I'll do the reading...

@andischerer , @mnquintana, Thanks again. My es-la keyboard is working now...

For all the Swiss people with Mac OS X and the @ problem with alt-g.
The following keymap.cson addition fixed the problem for me:

'atom-workspace':
    'alt-g': 'native!'

@prine Thanks a lot!!!

For Portuguese Asus (ABNT2) keyboards you could add this two lines to the kymap.cson file and it will solve the problem:

'.platform-win32 atom-text-editor, .platform-linux atom-text-editor':
'ctrl-alt-q': 'unset!'

I'm experiencing some annoying behaviour I think is related to this issue.

I'm using a uk keyboard with en-gb locale. My # is on the same key as tilde (~). When I type '#', '' is displayed. What should be displayed as ¬ (shift + key under Esc), atom shows as ~. When I type shift + #, I expect ~, but pipe (|) is shown. When I type '|' (shift + back slash), atom agrees!

Currently I have the problem, that F9 key on the same system behaves differently.
On the notebook shortcuts run fine but typing it on an attached keyboard results in a not working F9 key.

I opened the Key Binding Resolver (ctrl-.) but it won't recognize the key alone. So f9 isn't recognized while shift-f9 is.

Looks like it's already been delayed:

Fix international keyboard events
Original owner: dtapuska There are a series of international keyboard events that frustrate users. http://crbug.com/25503 http://crbug.com/42627 http://crbug.com/300475 Punted: blocked on tricky windows issue

Damn, so I guess we'll have to wait ...

Don't know if this could help, but with a Debian testing machine with an Italian keyboard the comment is made with Ctrl-ù instead of Ctrl-/

That also works with Windows.

ctrl - ù makes comment the same way of ctrl - / with the Italian keyboard

Andrea

On Wed, Dec 9, 2015 at 10:07 AM, ghtmtt notifications@github.com wrote:

Don't know if this could help, but with a Debian testing machine with an
Italian keyboard the comment is made with Ctrl-ù instead of Ctrl-/


Reply to this email directly or view it on GitHub
#37 (comment).

For french people, here is a part of my keymap.cson. It will solve this problem.

[ and ] character:

'atom-workspace atom-text-editor:not([mini])':
  'ctrl-alt-[': 'unset!'
  'ctrl-alt-]': 'unset!'

} character:

'atom-workspace atom-pane':
  'ctrl-alt-=': 'unset!'

@LMLB That resonates with my view at least. ctrl- is fine, alt- is fine, shift- with either ctrl and/or alt is fine. But never ctrl-alt-.

Must emphasize @andischerer and his great plugin https://github.com/andischerer/atom-keyboard-localization which totally does the job right! Sure you loose a few shortcuts, but less pain than having to unset! a bunch of keybindings.

so cool bro! 👍

Hey, i've got the same problem with the german keyboard layout. Is there any solution for this problem?

Thx

@hellobasti currently there's just workarounds. Much of that discussion is over in #35, basically look for this package and install it: https://atom.io/packages/keyboard-localization it will probably fix the most pressing problems for a german keyboard.

For me the localization package at #37 (comment) fixed the issue of not being able to type an opening bracket [. Thanks @andischerer! I am using the fr_BE layout. Note that an alias nl_BE would be nice. Quick info: one half of Belgium speaks French, the other Dutch - but we all (mostly) use an azerty (French) keyboard. (Oh, and a couple of folks in the East speak German. I am not sure which layout they'd use!)

This should be fixed starting with Atom 1.12.0.

Sorry for my ignorance, I tried to read all lines above.

Can anyone explain what to do to solve the problem than when I type ctrl + / " (for comment a line), Atom receives ctrl + &? and don't comment anything.

What to put and where

Thanks

@Albertc

  • short-term solution for most of the keyboard problems is this package: https://atom.io/packages/keyboard-localization for most people it's a "install it and be happy" thing.
  • long-term solution: Soon(tm) Atom 1.12 should be released, it features a big change in this general area. It may also solve your problem without any extra package.

I was about to give a try to Atom, but after seeing this issue, I'll wait for a couple more years. Good luck, and see you back in 2018.

I'll wait for a couple more years.

This issue has already been fixed in Atom 1.12.0 (if you decided to read the issue in its entirety, you would have realized that).

Personally I am using a danish layout and I also have the issue of wrong mapping.
Maybe I missed something in the 1000000 comments spread out into almost as many issues, but why is it that Atom doesn't look at the actual input given by the keyboard. I can write the right chars well enough, but it is simply the Key Binding Resolver that detects the wrong keys and executes an unintentinal action as a result.

Right now I am having the problem that I can't write the | char as the Resolver resolves ctrl-alt-| (or altGr-|) into ctrl-alt-[ and that is bound as a shortcut for an action. I will use the unset! technique, but to me that is just a hack to the real underlaying problem, that keystrokes are not resolved as sent from the keyboard.

I have stated this problem in atom/atom#6091 as well.

@Tokimon As I stated right above you, this issue will be fixed in the upcoming Atom 1.12.0 release.

@50Wliu I'm sorry for the sarcasm, and i'm glad for you if you eventually have a new system released a few days ago that eventually get the keyboard handling right (I did read that). However, it's now going to be rather hard for me to believe it's gonna be OK. So, yes this issue did harm atom's reputation, because keyboard handling cannot be an afterthought for a text editor! It should have been a basic requirement for releasing anything from day one.

@johan-boule I have called out the atom team on numerous occasions in many of the open issues. I've called them names, I was angry, I pointed fingers at them for "not caring". You know what? It took a while, it certainly took longer than i'd hoped it would, but now it's probably going to be alright.

There were major blockers in the way of getting this one right. This is also information buried in the 1000000 comments. It's fine for the vast majority of cases. Yes, there might be bugs, but the earlier those get found, the earlier they will get squashed. As far as I can tell, beta releases are for 1.11 - so the beta channel does not yet have the mentioned changes.

Sorry for the spam, but seeing the comments above, I just wanted to leave a huge THANK YOU to the atom team and contributors. You've made an incredible OSS editor and I know a lot of people like me that is grateful for that, even if we are quiet. ❤️

Sorry to "reopen" this issue, but... I'm on Atom 1.2.5, and the US International keyboard layout is not working for some keys. I'd already tried on a fresh Atom install, and on safe mode, without success. Even the keybinding-resolver is not showing the correct shortcut (i.e. the ^ accent, so essential to vim mode).

It was working very well on 1.2. I made a clean OS install and after reinstalled Atom, this issue just popped out.

nov-26-2016 13-42-27

Is there anything I should enable?

Thanks!

@hildersantos Please open a new issue for this bug, thanks.

Things are not working for me either.

I'm on MB Pro with macOS Sierra 10.12.6 (16G29)
Keyboard: Slovak QWERTZ
Atom version: 1.20.0

When I press cmd+' (as recognized in Sublime Text), Atom sees ctrl+§. Or cmd+/ (toggles comment in Sublime Text), Atom sees cmd+'.

Weird enough, macOS' native Keyboard viewer shows expected keys when typed, just Atom and VSCode seems to interpret them wrongly.
I suspect Electron has something to do with it...

I've already spent about 2 hours trying to resolve the issue, but I'm starting to lose my mind...

Any suggestions?

I think your chances are better opening a new ticket. You can of course link here if anything in this lengthy discussion helps understanding or fixing your issue.

Does it work on vi or emacs ? That may be an alternative.

This problem is still present I think.
My Locale is Persian. and the key bindings "Ctrl+C"/"Ctrl+V"/"Crtl+/" Don't work in Persian keyboard. It would be appreciated if it could be solved.
Thanks

@metemaddar Please open a new issue and fill out the entire issue template so we can take a look, thanks 🙇