Don't automatically focus when attach is called

Only focus when toggling the tree view or revealing
an active file.

This prevents the tree view from stealing focus when it
is attached during deserialization.
This commit is contained in:
Kevin Sawicki & Nathan Sobo 2013-02-25 11:49:06 -08:00
parent 969327e822
commit 94a17e73ba

View File

@ -72,15 +72,12 @@ class TreeView extends ScrollView
if @hasFocus()
@detach()
else
if @hasParent()
@focus()
else
@attach()
@attach() unless @hasParent()
@focus()
attach: ->
return unless project.getPath()
rootView.horizontal.prepend(this)
@focus()
detach: ->
@scrollTopAfterAttach = @scrollTop()
@ -134,6 +131,7 @@ class TreeView extends ScrollView
revealActiveFile: ->
@attach()
@focus()
return unless activeFilePath = rootView.getActiveEditor()?.getPath()