mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Ensure focus returns to the editor when file finder closes.
We just capture focusout events on root view… if anything other than the editors text area lost focus, we focus the editor again. This will likely need refinement when we add more widgets to the system, but its enough to make the fuzzy finder behave appropriately.
This commit is contained in:
@@ -37,7 +37,7 @@ class Editor extends Template
|
||||
@aceEditor.setTheme(require "ace/theme/twilight")
|
||||
@aceEditor.setKeyboardHandler
|
||||
handleKeyboard: (data, hashId, keyString, keyCode, event) =>
|
||||
if event and @keyEventHandler?.handleKeyEvent(event)
|
||||
if event and @keyEventHandler and @keyEventHandler.handleKeyEvent(event) == false
|
||||
{ command: { exec: -> }}
|
||||
else
|
||||
null
|
||||
@@ -45,6 +45,9 @@ class Editor extends Template
|
||||
getAceSession: ->
|
||||
@aceEditor.getSession()
|
||||
|
||||
focus: ->
|
||||
@aceEditor.focus()
|
||||
|
||||
save: ->
|
||||
if @buffer.url
|
||||
@buffer.save()
|
||||
|
||||
@@ -32,6 +32,9 @@ class RootView extends Template
|
||||
|
||||
@on 'toggle-file-finder', => @toggleFileFinder()
|
||||
|
||||
@on 'focusout', (e) =>
|
||||
@editor.focus() unless e.target is @editor.find('textarea')[0]
|
||||
|
||||
createProject: (url) ->
|
||||
if url
|
||||
@project = new Project(fs.directory(url))
|
||||
|
||||
Reference in New Issue
Block a user