mirror of
https://github.com/atom/atom.git
synced 2026-01-26 15:28:27 -05:00
Make command-panel sticky like tree view is (fit into the "tool panel" scheme)
Esc on the command panel just moves focus back to the editor. Ctrl-0 will move focus back to the panel if it is open but not focused.
This commit is contained in:
@@ -38,6 +38,7 @@ class CommandPanel extends View
|
||||
@commandInterpreter = new CommandInterpreter()
|
||||
@history = []
|
||||
|
||||
@on 'command-panel:unfocus', => @rootView.focus()
|
||||
@rootView.on 'command-panel:toggle', => @toggle()
|
||||
@rootView.on 'command-panel:execute', => @execute()
|
||||
@rootView.on 'command-panel:find-in-file', => @attach("/")
|
||||
@@ -50,8 +51,12 @@ class CommandPanel extends View
|
||||
@miniEditor.on 'move-down', => @navigateForwardInHistory()
|
||||
|
||||
toggle: ->
|
||||
if @parent().length then @detach() else @attach()
|
||||
false
|
||||
if @miniEditor.isFocused
|
||||
@detach()
|
||||
@rootView.focus()
|
||||
else
|
||||
@attach() unless @hasParent()
|
||||
@miniEditor.focus()
|
||||
|
||||
attach: (text='') ->
|
||||
@rootView.append(this)
|
||||
|
||||
@@ -6,7 +6,7 @@ window.keymap.bindKeys '*'
|
||||
|
||||
window.keymap.bindKeys '.command-panel .editor input',
|
||||
'meta-w': 'command-panel:toggle'
|
||||
escape: 'command-panel:toggle'
|
||||
escape: 'command-panel:unfocus'
|
||||
enter: 'command-panel:execute'
|
||||
|
||||
window.keymap.bindKeys '.editor',
|
||||
|
||||
Reference in New Issue
Block a user