{"action":"created","issue":{"url":"https://api.github.com/repos/atom/atom-keymap/issues/178","repository_url":"https://api.github.com/repos/atom/atom-keymap","labels_url":"https://api.github.com/repos/atom/atom-keymap/issues/178/labels{/name}","comments_url":"https://api.github.com/repos/atom/atom-keymap/issues/178/comments","events_url":"https://api.github.com/repos/atom/atom-keymap/issues/178/events","html_url":"https://github.com/atom/atom-keymap/pull/178","id":189471902,"number":178,"title":"Don’t handle or replay keystrokes during IME composition","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":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-11-15T18:38:14Z","updated_at":"2016-11-16T16:06:31Z","closed_at":"2016-11-15T19:58:22Z","pull_request":{"url":"https://api.github.com/repos/atom/atom-keymap/pulls/178","html_url":"https://github.com/atom/atom-keymap/pull/178","diff_url":"https://github.com/atom/atom-keymap/pull/178.diff","patch_url":"https://github.com/atom/atom-keymap/pull/178.patch"},"body":"Closes #172\r\nCloses #177\r\n\r\nIn #144, we completely overhauled translation of keyboard events to keystrokes, inadvertently fixing a bug in keystroke resolution that was causing all keystrokes to be recognized as `å` when an IME dialog was visible. Unfortunately, this previous *bug* was actually a *feature* in that it prevented any key bindings from matching during an IME editing session. By enabling correct keystroke resolution during IME editing, #144 actually caused interference with the IME user interface... the arrow keys not only change the IME selection, they also move the cursor... enter inserts a new line instead of selecting a character... etc.\r\n\r\nIn addition, *replaying* input events for previous partial match prefixes yields incorrect behavior when the IME dialog is visible, because in those cases we really want previous keystrokes to combine with new keystrokes to build up a composed character. For now, if we detect that the IME interface is visible, we suppress replay entirely.\r\n\r\nGetting IME and multi-stroke bindings to interact perfectly is a really nuanced problem. For example, it's possible that *some* of the keystrokes need to be replayed but not all of them. Also, what if a partially matched multi-stroke binding prevented the IME interface from popping up to begin with. Since our replay mechanism doesn't work at the browser level (maybe it should?) we won't open the IME dialog in those cases.\r\n\r\nBecause `compositionstart` events do not occur until *after* `keydown` events, I've needed to defer terminating the pending state until the `keyup` event following the `keydown` where we previously terminated. This ensures that the `compositionstart` event has been received so we can suppress replay if a composition is in progress. @iolsen this seems like it will work, but you've had your head wrapped around this system recently as well. Do you foresee any issues I'm missing?\r\n\r\nFor now, I think we should draw the line here. IME users will just need to be careful about conflicts with multi-stroke unmodified bindings. This is a pretty extreme edge case, and going further is going to involve a complete rethink of our approach to replay that we don't have time for right now.\r\n"},"comment":{"url":"https://api.github.com/repos/atom/atom-keymap/issues/comments/260986869","html_url":"https://github.com/atom/atom-keymap/pull/178#issuecomment-260986869","issue_url":"https://api.github.com/repos/atom/atom-keymap/issues/178","id":260986869,"user":{"login":"t9md","id":155205,"avatar_url":"https://avatars.githubusercontent.com/u/155205?v=3","gravatar_id":"","url":"https://api.github.com/users/t9md","html_url":"https://github.com/t9md","followers_url":"https://api.github.com/users/t9md/followers","following_url":"https://api.github.com/users/t9md/following{/other_user}","gists_url":"https://api.github.com/users/t9md/gists{/gist_id}","starred_url":"https://api.github.com/users/t9md/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t9md/subscriptions","organizations_url":"https://api.github.com/users/t9md/orgs","repos_url":"https://api.github.com/users/t9md/repos","events_url":"https://api.github.com/users/t9md/events{/privacy}","received_events_url":"https://api.github.com/users/t9md/received_events","type":"User","site_admin":false},"created_at":"2016-11-16T16:06:31Z","updated_at":"2016-11-16T16:06:31Z","body":"If the original event was `compositionstart`, then bypass the keymap system, clear the pending keystroke, I'm not sure things are such simple.\r\n\r\nIf you want me do further check, I can do that.\r\n"}}
{"actor":{"display_login":"t9md"}}