Permalink
Browse files

Fix #905

  • Loading branch information...
DisposaBoy committed Jan 11, 2019
1 parent 9be2a67 commit b1a490fe87db8de906acf9350f1fb8a93ff9ac17
Showing with 21 additions and 17 deletions.
  1. +21 −17 gosubl/margo.py
@@ -34,6 +34,7 @@ def __init__(self):
}
self.file_ids = []
self._hud_state = {}
self._hud_state_lock = threading.Lock()
self.hud_name = 'GoSublime/HUD'
self.hud_id = self.hud_name.replace('/','-').lower()
self._views = {}
@@ -208,7 +209,9 @@ def is_hud_view(self, view):
if view is None:
return False

v, _ = self._hud_win_state(view.window())
with self._hud_state_lock:
v, _ = self._hud_win_state(view.window())

return v is not None and view.id() == v.id()

def _hud_win_state(self, win):
@@ -219,23 +222,24 @@ def _hud_win_state(self, win):
return self._hud_state.get(win.id()) or default

def hud_panel(self, win):
view, phantoms = self._hud_win_state(win)
wid = win.id()
m = self._hud_state
with self._hud_state_lock:
view, phantoms = self._hud_win_state(win)
wid = win.id()
m = self._hud_state

if view is None:
view = self._hud_create_panel(win)
m[wid] = (view, phantoms)

if phantoms is None:
phantoms = sublime.PhantomSet(view, self.hud_name)
m[wid] = (view, phantoms)

if len(m) > 1:
wids = [w.id() for w in sublime.windows()]
for id in m.keys():
if id not in wids:
del m[id]
if view is None:
view = self._hud_create_panel(win)
m[wid] = (view, phantoms)

if phantoms is None:
phantoms = sublime.PhantomSet(view, self.hud_name)
m[wid] = (view, phantoms)

if len(m) > 1:
wids = [w.id() for w in sublime.windows()]
for id in m.keys():
if id not in wids:
del m[id]

return (view, phantoms)

0 comments on commit b1a490f

Please sign in to comment.