Skip to content

Commit

Permalink
Refactor preview unloading
Browse files Browse the repository at this point in the history
ST3 reliably calls plugin_unloaded() when disabling packages.
  • Loading branch information
deathaxe committed Dec 26, 2024
1 parent 4c573af commit c49c2ff
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
21 changes: 0 additions & 21 deletions 04_reset_phantoms.py

This file was deleted.

9 changes: 9 additions & 0 deletions st_preview/preview_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ def plugin_loaded():


def plugin_unloaded():
for w in sublime.windows():
for v in w.views():
if not v.match_selector(0, 'text.tex.latex'):
continue

v.erase_phantoms(_name)
v.settings().clear_on_change(_name)

_lt_settings.clear_on_change(_name)
_lt_settings.clear_on_change("lt_preview_image_main")


Expand Down
9 changes: 9 additions & 0 deletions st_preview/preview_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ def plugin_loaded():
def plugin_unloaded():
global _IS_ENABLED
_IS_ENABLED = False

for w in sublime.windows():
for v in w.views():
if not v.match_selector(0, 'text.tex.latex'):
continue
v.erase_phantoms(_name)
v.settings().clear_on_change(_name)

_lt_settings.clear_on_change(_name)
_lt_settings.clear_on_change("lt_preview_math_main")


Expand Down

0 comments on commit c49c2ff

Please sign in to comment.