Skip to content

Commit 62af315

Browse files
committed
Merge branch 'st3'
2 parents 82d488b + a5b8c6e commit 62af315

24 files changed

+376
-509
lines changed

Default (Linux).sublime-keymap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,11 @@ LaTeX Package keymap for Linux
424424

425425
{
426426
"keys": ["tab"],
427-
"command": "latextools_confirm_quickpanel",
427+
"command": "select",
428428
"context": [
429429
{ "key": "overlay_visible" },
430-
{ "key": "latextools.input_overlay_visible" },
430+
{ "key": "setting.auto_complete_commit_on_tab" },
431+
{ "key": "latextools.input_overlay_visible" }
431432
],
432433
},
433434

Default (OSX).sublime-keymap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,11 @@ LaTeX Package keymap for OS X
424424

425425
{
426426
"keys": ["tab"],
427-
"command": "latextools_confirm_quickpanel",
427+
"command": "select",
428428
"context": [
429429
{ "key": "overlay_visible" },
430-
{ "key": "latextools.input_overlay_visible" },
430+
{ "key": "setting.auto_complete_commit_on_tab" },
431+
{ "key": "latextools.input_overlay_visible" }
431432
],
432433
},
433434

Default (Windows).sublime-keymap

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,11 @@ LaTeX Package keymap for Linux
424424

425425
{
426426
"keys": ["tab"],
427-
"command": "latextools_confirm_quickpanel",
427+
"command": "select",
428428
"context": [
429429
{ "key": "overlay_visible" },
430-
{ "key": "latextools.input_overlay_visible" },
430+
{ "key": "setting.auto_complete_commit_on_tab" },
431+
{ "key": "latextools.input_overlay_visible" }
431432
],
432433
},
433434

LaTeXTools.sublime-settings

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@
206206

207207
// Ends of the names of temporary files to be deleted
208208
"temp_files_exts": [
209-
".blg",".bbl",".aux",".log",".brf",".nlo",".out",".dvi",".ps",
210-
".lof",".toc",".fls",".fdb_latexmk",".pdfsync",".synctex.gz",
211-
".ind",".ilg",".idx"
209+
".aux", ".bbl", ".blg", ".brf", ".dvi", ".fdb_latexmk", ".fls",
210+
".glo", ".idx", ".ilg", ".ind", ".lof", ".log", ".nlo", ".out",
211+
".pdfsync", ".ps", ".synctex.gz", ".thm", ".toc", ".xdy",
212212
],
213213

214214
// Folders that are not traversed when deleting temp files
@@ -550,19 +550,17 @@
550550
// ------------------------------------------------------------------
551551

552552
// OPTION: "bibliography"
553-
// Either a single bibliography plugin to use or a list of plugins
553+
// Either a single bibliography plugin to use or a list of plugins
554554
// which will be executed in order, stopping after the first result
555-
// found
555+
// found.
556556
//
557557
// Possible values:
558558
//
559-
// "traditional" the default, regex-based bibliography
560-
// parsing
559+
// "traditional" simple regex-based bibliography parsing
561560
//
562-
// "new" a newer parser which supports more complex
563-
// formatting and additional fields, but may
564-
// be slower
565-
"bibliography": "traditional",
561+
// "new" (default) a parser which supports more
562+
// complex formatting and additional fields.
563+
"bibliography": "new",
566564

567565
// OPTION: "additional_bibliography_file"
568566
// With this setting you can add the path to one or more additional

latextools/deprecated_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
_setting_name = "compatibility_enable_version3_commands"
1010

1111

12-
class LatextoolsDeprecatedCommand(object):
12+
class LatextoolsDeprecatedCommand:
1313
# every subclass should overwrite this attribute
1414
new_classname = ""
1515

latextools/latex_cite_completions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,9 @@ def get_completions(self, view, prefix, line):
507507
sublime.status_message("No bib files found!")
508508
return
509509
except BibParsingError as e:
510-
traceback.print_exc()
511-
sublime.status_message("Error occurred parsing {0}. {1}.".format(e.filename, e.message))
510+
msg = "Error occurred parsing {0}. {1}.".format(e.filename, e.message)
511+
logger.error(msg)
512+
sublime.status_message(msg)
512513
return
513514

514515
if prefix:

latextools/latex_cwl_completions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def get_cwl_completions():
7777
return CWL_COMPLETIONS
7878

7979

80-
class CwlCompletions(object):
80+
class CwlCompletions:
8181
"""
8282
Completion manager that coordinates between between the event listener and
8383
the thread that does the actual parsing. It also stores the completions

latextools/latex_env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def run(self, edit, **args):
2828
if environment:
2929
environment_region = sublime.Region(point - len(environment), point)
3030
view.erase(edit, environment_region)
31-
snippet = "\\\\begin{" + environment + "}\n$1\n\\\\end{" + environment + "}$0"
31+
snippet = "\\\\begin{" + environment + "}\n\t$0\n\\\\end{" + environment + "}"
3232
else:
33-
snippet = "\\\\begin{${1:env}}\n$2\n\\end{$1}$0"
33+
snippet = "\\\\begin{${1:env}}\n\t$0\n\\end{$1}"
3434
view.run_command("insert_snippet", {"contents": snippet})
3535
else:
3636
sublime.status_message(

latextools/latex_fill_all.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from .utils.logging import logger
1212
from .utils.settings import get_setting
1313
from .utils.internal_types import FillAllHelper
14-
from .utils.input_quickpanel import show_input_quick_panel
1514

1615
__all__ = [
1716
"LatexFillAllEventListener",
@@ -20,6 +19,8 @@
2019
"LatexToolsReplaceWord",
2120
]
2221

22+
VISIBLE_OVERLAYS = set()
23+
2324
def reraise(tp, value, tb=None):
2425
if value is None:
2526
value = tp()
@@ -28,7 +29,7 @@ def reraise(tp, value, tb=None):
2829
raise value
2930

3031

31-
class LatexFillHelper(object):
32+
class LatexFillHelper:
3233
"""
3334
Base class for some LaTeXTools TextCommands. Implements several methods
3435
helpful for inserting text into the view and updating the cursor posiiton.
@@ -65,7 +66,7 @@ def complete_auto_match(self, view, edit, insert_char):
6566
:param insert_char:
6667
the character to try to automatch
6768
"""
68-
if sublime.load_settings("Preferences.sublime-settings").get("auto_match_enabled", True):
69+
if view.settings().get("auto_match_enabled", True):
6970
# simple case: we have an insert char, insert closing char,
7071
# if its defined
7172
if insert_char:
@@ -569,7 +570,7 @@ def match_selector(self, view, selector):
569570
return all(view.match_selector(sel.b, selector) for sel in view.sel())
570571

571572

572-
class LatexFillAllPluginConsumer(object):
573+
class LatexFillAllPluginConsumer:
573574
"""
574575
Base class for classes which use FillAllHelper plugins
575576
"""
@@ -628,6 +629,14 @@ def on_query_context(self, view, key, operator, operand, match_all):
628629
key is "lt_fill_all_{name}" where name is the short name of the
629630
completion type, e.g. "lt_fill_all_cite", etc.
630631
"""
632+
633+
# autofill input quick panel visible
634+
if key == "latextools.input_overlay_visible":
635+
try:
636+
return view.window().id() in VISIBLE_OVERLAYS
637+
except:
638+
return False
639+
631640
# quick exit conditions
632641
if not key.startswith("lt_fill_all_"):
633642
return None
@@ -991,8 +1000,13 @@ def run(self, edit, completion_type=None, insert_char="", overwrite=False, force
9911000
self.remove_regions(view, edit, remove_regions)
9921001
self.clear_bracket_cache()
9931002
else:
1003+
window = view.window()
1004+
if not window:
1005+
self.clear_bracket_cache()
1006+
return
9941007

9951008
def on_done(i, text=""):
1009+
VISIBLE_OVERLAYS.discard(window.id())
9961010
if i is None:
9971011
insert_text = text
9981012
elif i < 0:
@@ -1019,7 +1033,10 @@ def on_done(i, text=""):
10191033
},
10201034
)
10211035

1022-
show_input_quick_panel(view.window(), formatted_completions, on_done)
1036+
# track visible input quick panels to provide key binding context
1037+
VISIBLE_OVERLAYS.add(window.id())
1038+
window.show_quick_panel(formatted_completions, on_done)
1039+
10231040
self.clear_bracket_cache()
10241041

10251042

latextools/utils/analysis.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class FileNotAnalyzed(Exception):
131131
pass
132132

133133

134-
class Analysis(object):
134+
class Analysis:
135135

136136
def __init__(self, tex_root):
137137
self._tex_root = tex_root
@@ -159,7 +159,7 @@ def tex_base_path(self, file_path):
159159
This is usually the folder of the tex root, but can change if
160160
the import package is used.
161161
Use this instead of the tex root path to implement functions
162-
like the \input command completion.
162+
like the \\input command completion.
163163
"""
164164
file_path = os.path.normpath(file_path)
165165
try:
@@ -341,7 +341,8 @@ def get_analysis(tex_root):
341341
raise TypeError("tex_root must be a string or view")
342342

343343
result = LocalCache(tex_root).cache("analysis", partial(analyze_document, tex_root))
344-
result._freeze()
344+
if result:
345+
result._freeze()
345346
return result
346347

347348

@@ -575,7 +576,7 @@ def rowcol(pos):
575576
return rowcol
576577

577578

578-
class objectview(object):
579+
class objectview:
579580
"""
580581
Converts an dict into an object, such that every dict entry
581582
is an attribute of the object

0 commit comments

Comments
 (0)