From 94a17e73baf5a458f351aed904f03403aebb4c16 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki & Nathan Sobo Date: Mon, 25 Feb 2013 11:49:06 -0800 Subject: [PATCH] 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. --- src/packages/tree-view/lib/tree-view.coffee | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/packages/tree-view/lib/tree-view.coffee b/src/packages/tree-view/lib/tree-view.coffee index 9e71a5a05..ff0408607 100644 --- a/src/packages/tree-view/lib/tree-view.coffee +++ b/src/packages/tree-view/lib/tree-view.coffee @@ -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()