@@ -124,6 +124,9 @@ def revealLater():
124124
125125class SideBarListener (sublime_plugin .EventListener ):
126126 def on_activated (self , view ):
127+
128+ self .packageSettings = sublime .load_settings ('SyncedSideBar.sublime-settings' )
129+
127130 # don't even consider updating state if we don't have a window.
128131 # reveal in side bar is a window command only.
129132 # 'goto anything' activates views but doesn't set a window until the file is selected.
@@ -142,11 +145,22 @@ def on_activated(self, view):
142145
143146 # Sublime text v3 window command listener, safe to include unconditionally as it's simply ignored by v2.
144147 # Eventually, v3 support below 3098 will be dropped and this can be deleted.
145- def on_window_command (self , window , command_name , args ):
146- if command_name == 'toggle_side_bar' :
148+ def on_window_command (self , window , command , args ):
149+ if command == 'toggle_side_bar' :
147150 global sidebarVisible
148151 sidebarVisible = not sidebarVisible
149152
153+ # This is needed for the `on_post_window_command` to work
154+ if command == 'reveal_in_side_bar' :
155+ self .last_view = window .active_view ()
156+
157+
158+ # Back to the file window after `reveal_in_side_bar` command
159+ def on_post_window_command (self , window , command , args ):
160+ if command == 'reveal_in_side_bar' :
161+ if self .packageSettings .get ('focus-on-view' ):
162+ window .focus_view (self .last_view )
163+
150164
151165class SideBarUpdateSync (sublime_plugin .ApplicationCommand ):
152166 # Update user preferences with the new value
0 commit comments