-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathViewListener.py
More file actions
33 lines (24 loc) · 762 Bytes
/
ViewListener.py
File metadata and controls
33 lines (24 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import re
import copy
import sublime_plugin
import FuzzyFilePath.controller as controller
import FuzzyFilePath.current_state as state
temp_views = []
def is_valid(view):
if view.file_name():
return True
if not view.id() in temp_views:
temp_views.append(view.id())
return False
class ViewListener(sublime_plugin.EventListener):
def on_post_save_async(self, view):
if view.id() in temp_views:
self.on_file_created(view)
self.on_activated(view)
def on_activated(self, view):
# view has gained focus
if is_valid(view):
controller.on_file_focus(view)
def on_file_created(self, view):
temp_views.remove(view.id())
controller.on_file_created()