From 5bbec63a11e44feb1ff550a16c486fef68a3eaac Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 21 Oct 2019 10:57:57 +0100 Subject: [PATCH] Allow use of math preview in embedded latex scopes The previous formulation required character 0 of the document to be consider LaTeX. This change allows the preview to apply to any document which contains embedded latex scopes. --- st_preview/preview_math.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st_preview/preview_math.py b/st_preview/preview_math.py index 1f727f86..4175f16d 100644 --- a/st_preview/preview_math.py +++ b/st_preview/preview_math.py @@ -529,7 +529,7 @@ def _read_latex_template_file(self, refresh=False): def is_applicable(cls, settings): try: view = inspect.currentframe().f_back.f_locals['view'] - return view.score_selector(0, 'text.tex.latex') > 0 + return len(view.find_by_selector('text.tex.latex')) > 0 except KeyError: syntax = settings.get('syntax') return syntax == 'Packages/LaTeX/LaTeX.sublime-syntax'