Skip to content

Commit 3134c39

Browse files
authored
Fixed philc#3068
Fixed frustrating IME leftover issue when press ESC in input
1 parent 342723b commit 3134c39

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/keyboard_utils.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ KeyboardUtils =
6666

6767
(event) ->
6868
# <c-[> is mapped to Escape in Vim by default.
69-
event.key == "Escape" or (useVimLikeEscape and @getKeyCharString(event) == "<c-[>")
69+
# Escape with a keyCode 229 means that this event comes from IME, and should not be treat as a directly/normal ESC press.
70+
# In this case, IME will take care of the ESC press event, not vimium.
71+
# See https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
72+
(event.key == "Escape" and event.keyCode != 229) or (useVimLikeEscape and @getKeyCharString(event) == "<c-[>")
7073

7174
isBackspace: (event) ->
7275
event.key in ["Backspace", "Delete"]

0 commit comments

Comments
 (0)