mirror of
https://github.com/atom/atom.git
synced 2026-02-13 08:04:56 -05:00
Start implementing "tool-panel" keymap scheme
Tool panels will be mapped to ctrl-# bindings. If the panel is focused, the # binding closes it. Otherwise the # binding shows it (if needed) and focuses it. The esc key unfocuses the panel, but does not necessarily close it. Meta-w always closes the panel. This is the scheme. Right now we only have 2 panels: Command Panel: Ctrl-0, esc still hides it Tree View: Ctrl-1, esc just unfocuses it
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
window.keymap.bindKeys '#root-view'
|
||||
'alt-tab': 'tree-view:focus'
|
||||
'ctrl-1': 'tree-view:toggle'
|
||||
'ctrl-T': 'tree-view:toggle'
|
||||
'alt-tab': 'tree-view:focus'
|
||||
|
||||
window.keymap.bindKeys '.tree-view'
|
||||
'escape': 'tree-view:unfocus'
|
||||
'meta-w': 'tree-view:toggle'
|
||||
'right': 'tree-view:expand-directory'
|
||||
'left': 'tree-view:collapse-directory'
|
||||
'enter': 'tree-view:open-selected-entry'
|
||||
|
||||
@@ -49,6 +49,7 @@ class TreeView extends View
|
||||
@on 'tree-view:add', => @add()
|
||||
@on 'tree-view:remove', => @removeSelectedEntry()
|
||||
@on 'tree-view:directory-modified', => @selectActiveFile()
|
||||
@on 'tree-view:unfocus', => @rootView.focus()
|
||||
@rootView.on 'tree-view:toggle', => @toggle()
|
||||
@rootView.on 'active-editor-path-change', => @selectActiveFile()
|
||||
@rootView.project.on 'path-change', => @updateRoot()
|
||||
@@ -71,11 +72,11 @@ class TreeView extends View
|
||||
@root?.unwatchEntries()
|
||||
|
||||
toggle: ->
|
||||
if @hasParent()
|
||||
if @is(':focus')
|
||||
@detach()
|
||||
@rootView.focus()
|
||||
else
|
||||
@attach()
|
||||
@attach() unless @hasParent()
|
||||
@focus()
|
||||
|
||||
attach: ->
|
||||
|
||||
Reference in New Issue
Block a user