Skip to content

Commit

Permalink
Use isModifierKey everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-petrov committed Mar 27, 2014
1 parent fabeb3f commit 63e0ea0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions coffee/frontend/cmds.coffee
Expand Up @@ -3,8 +3,8 @@ CancelKey = ['<Esc>', '<C-[>']
CtrlAcceptKey = ['<C-Enter>']
CtrlEscapeKey = ['<C-Esc>']

window.isControlKey = (key) ->
key in ['Control', 'Shift', 'Alt', 'Win']
window.isModifierKey = (key) ->
key in ['Control', 'Shift', 'Alt', 'Win', 'Meta']

window.isCtrlAcceptKey = (key) ->
key in CtrlAcceptKey
Expand Down
2 changes: 1 addition & 1 deletion coffee/frontend/modules/get-key.coffee
Expand Up @@ -114,7 +114,7 @@ specialKeys["F#{key}"] = null for key in [1..12]

window.getKey = (evt) ->
evt = evt.originalEvent or evt
return evt.keyIdentifier if evt.keyIdentifier in ['Control', 'Alt', 'Meta', 'Shift']
return evt.keyIdentifier if isModifierKey evt.keyIdentifier

key = keyId[evt.keyIdentifier] or evt.keyIdentifier

Expand Down
2 changes: 1 addition & 1 deletion coffee/frontend/modules/key-event.coffee
Expand Up @@ -139,7 +139,7 @@ class window.KeyEvent

# If Vrome in pass-next or disabled mode and using <C-Esc> to enable it.
return @enable() if not insertMode and (passNextKey or (disableVrome and isCtrlEscapeKey(key)))
return @stopPropagation e if key in ['Control', 'Alt', 'Shift']
return @stopPropagation e if isModifierKey key
return if disableVrome

currentKeys = filterKey currentKeys.concat(key), insertMode
Expand Down
2 changes: 1 addition & 1 deletion coffee/frontend/modules/search.coffee
Expand Up @@ -34,7 +34,7 @@ class window.Search
handleInput = (e) =>
return unless searchMode
key = getKey e
@removeHighlights() unless key is 'Enter' or isControlKey key
@removeHighlights() unless key is 'Enter' or isModifierKey key
lastSearch =
text: CmdBox.get().content
position: 0
Expand Down

0 comments on commit 63e0ea0

Please sign in to comment.