{"action":"created","issue":{"url":"https://api.github.com/repos/atom/atom-keymap/issues/144","repository_url":"https://api.github.com/repos/atom/atom-keymap","labels_url":"https://api.github.com/repos/atom/atom-keymap/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/atom/atom-keymap/issues/144/comments","events_url":"https://api.github.com/repos/atom/atom-keymap/issues/144/events","html_url":"https://github.com/atom/atom-keymap/pull/144","id":176971935,"number":144,"title":"Improve support for international keyboards","user":{"login":"nathansobo","id":1789,"avatar_url":"https://avatars.githubusercontent.com/u/1789?v=3","gravatar_id":"","url":"https://api.github.com/users/nathansobo","html_url":"https://github.com/nathansobo","followers_url":"https://api.github.com/users/nathansobo/followers","following_url":"https://api.github.com/users/nathansobo/following{/other_user}","gists_url":"https://api.github.com/users/nathansobo/gists{/gist_id}","starred_url":"https://api.github.com/users/nathansobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathansobo/subscriptions","organizations_url":"https://api.github.com/users/nathansobo/orgs","repos_url":"https://api.github.com/users/nathansobo/repos","events_url":"https://api.github.com/users/nathansobo/events{/privacy}","received_events_url":"https://api.github.com/users/nathansobo/received_events","type":"User","site_admin":true},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-14T17:37:51Z","updated_at":"2016-09-14T21:30:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/atom/atom-keymap/pulls/144","html_url":"https://github.com/atom/atom-keymap/pull/144","diff_url":"https://github.com/atom/atom-keymap/pull/144.diff","patch_url":"https://github.com/atom/atom-keymap/pull/144.patch"},"body":"Closes #35\r\n\r\nNow that the new `KeyboardEvent.key` and `KeyboardEvent.code` APIs are available in Chrome, we can finally support international keyboard layouts in core without a building tower of fragile hacks. This isn't as straightforward as I'd hoped, but this PR updates our translation of keyboard events to keystroke strings as follows:\r\n\r\n### `AltGraph` handling\r\n\r\n#### On Windows and Linux\r\n\r\nThe keystroke's primary character is always based on the `.key` property of the keyboard event. If we determine that the `AltGraph` key is depressed via `KeyboardEvent.getModifierState`, we don't render `alt` as part of the keystroke. On Windows, we also don't render `ctrl` as part of the keystroke since `ctrl-alt-` is commonly used as a substitute for the physical `AltGraph` key.\r\n\r\n#### On macOS\r\n\r\nLike the other platforms, we base the primary character on the `.key` property of the keyboard event.\r\n\r\nBecause Macs don't have a dedicated `AltGraph` key, we need to be more nuanced about interpreting the user's intent when they use the Mac `⌥` key. If we always interpreted `⌥` to mean `AltGraph`, many `alt-` bindings would become impossible to type on macOS. Instead, we only consider `⌥` to mean `AltGraph` when `KeyboardEvent.key` is in the basic ASCII character range. If `⌥` is used and the typed character is non-ASCII, we use a native node module to determine the non-`⌥`-modified variant of the character based on the physical location of the key (`KeyboardEvent.code`) and the current system keyboard layout.\r\n\r\nFor example, on a Swiss-German layout, we will resolve `⌥G` keystrokes to `@` rather than `alt-g` because `@` is an ASCII symbol. However, we won't resolve `⌥G` to `©` on a U.S. layout because we consider the ability to bind `alt-g` more important than typing copyright symbols. However, if you *want* to type `©` with `⌥G`, that will work fine as long as there are no existing `alt-g` bindings. As a text editor used to write code, we considered it worthwhile to treat ASCII as a special case and protect the ability to type basic ASCII from any packages that might accidentally shadow those keystrokes with `alt-` bindings.\r\n\r\n### Key bindings on non-Latin layouts\r\n\r\nIf you're using a Greek keyboard on macOS, `⌘Σ` does not exist as a binding. If you type that physical key combination, it actually resolves to `⌘S`, which is the default binding for saving a document.\r\n\r\nIn Atom, we've tried to copy this behavior. Basically, bindings can be expressed only with Latin characters. So `alt-u` can be bound and so can `alt-ü`, but on non-Latin layouts, keystrokes with modifiers convert the typed character to its equivalent on a U.S. layout.\r\n\r\nApologies if this appears to be a culturally insensitive approach... We're trying to match the expected behavior and it seemed like macOS is a good guide in this respect. Please let us know if we're missing some nuance here.\r\n"},"comment":{"url":"https://api.github.com/repos/atom/atom-keymap/issues/comments/247161206","html_url":"https://github.com/atom/atom-keymap/pull/144#issuecomment-247161206","issue_url":"https://api.github.com/repos/atom/atom-keymap/issues/144","id":247161206,"user":{"login":"ccoenen","id":124909,"avatar_url":"https://avatars.githubusercontent.com/u/124909?v=3","gravatar_id":"","url":"https://api.github.com/users/ccoenen","html_url":"https://github.com/ccoenen","followers_url":"https://api.github.com/users/ccoenen/followers","following_url":"https://api.github.com/users/ccoenen/following{/other_user}","gists_url":"https://api.github.com/users/ccoenen/gists{/gist_id}","starred_url":"https://api.github.com/users/ccoenen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccoenen/subscriptions","organizations_url":"https://api.github.com/users/ccoenen/orgs","repos_url":"https://api.github.com/users/ccoenen/repos","events_url":"https://api.github.com/users/ccoenen/events{/privacy}","received_events_url":"https://api.github.com/users/ccoenen/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T21:30:43Z","updated_at":"2016-09-14T21:30:43Z","body":"@nathansobo I added the info to my previous Post: It's Windows 10.\r\n\r\n(I'll also remove this post right after posting so you get a notification but everyone else won't have to put up with me forgetting vital information :D )"}}
{"actor":{"display_login":"ccoenen"}}