mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Bind keydown on root view to catch events that aren't handled by ace
Also fixed a bug where the GlobalKeymap wasn't returning true when it matched a binding, which caused key events to be processed twice when they bubbled out of the editor and hit the root view.
This commit is contained in:
committed by
Corey Johnson & Nathan Sobo
parent
7f4120ce36
commit
2a80a72d64
@@ -38,7 +38,7 @@ class Editor extends Template
|
||||
@aceEditor.setKeyboardHandler
|
||||
handleKeyboard: (data, hashId, keyString, keyCode, event) =>
|
||||
if event and @keyEventHandler?.handleKeyEvent(event)
|
||||
{command: {exec: ->}}
|
||||
{ command: { exec: -> }}
|
||||
else
|
||||
null
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@ class GlobalKeymap
|
||||
for bindingSet in candidateBindingSets
|
||||
if command = bindingSet.commandForEvent(event)
|
||||
$(event.target).trigger(command)
|
||||
return
|
||||
return true
|
||||
currentNode = currentNode.parent()
|
||||
false
|
||||
|
||||
@@ -22,7 +22,7 @@ class RootView extends Template
|
||||
|
||||
initialize: ({url}) ->
|
||||
@globalKeymap = new GlobalKeymap
|
||||
|
||||
@on 'keydown', (e) => @globalKeymap.handleKeyEvent(e)
|
||||
@editor.keyEventHandler = @globalKeymap
|
||||
|
||||
@globalKeymap.bindKeys '*'
|
||||
@@ -30,7 +30,7 @@ class RootView extends Template
|
||||
'meta-w': 'close'
|
||||
'meta-t': 'toggle-file-finder'
|
||||
|
||||
@on 'toggle-file-finder', (e) => @toggleFileFinder()
|
||||
@on 'toggle-file-finder', => @toggleFileFinder()
|
||||
|
||||
if url
|
||||
@project = new Project(fs.directory(url))
|
||||
|
||||
Reference in New Issue
Block a user