Implement moving-up in tree view

This commit is contained in:
Nathan Sobo
2012-04-24 16:43:51 -06:00
parent 35b68514ed
commit 9a1d3e00b2
2 changed files with 48 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ class TreeView extends View
@selectEntry(entry)
false
@on 'move-up', => @moveUp()
@on 'move-down', => @moveDown()
@rootView.on 'active-editor-path-change', => @selectActiveFile()
@@ -36,6 +37,14 @@ class TreeView extends View
else
@selectEntry(@root)
moveUp: ->
selectedEntry = @selectedEntry()
if selectedEntry[0]
return if @selectEntry(selectedEntry.prev())
return if @selectEntry(selectedEntry.parents('.directory').first())
else
@selectEntry(@find('.entry').last())
selectedEntry: ->
@find('.selected')