Skip to content

Commit 6b81a37

Browse files
committed
Use built-in "append" to add content to build output
The `append` command is what ST's default build executor uses to add content to otherwise read-only build output and scroll to the end.
1 parent 7e56db7 commit 6b81a37

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

latextools/make_pdf.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
__all__ = [
4242
"LatextoolsMakePdfCommand",
43-
"LatextoolsDoOutputEditCommand",
4443
"LatextoolsDoFinishEditCommand",
4544
"LatextoolsExecEventListener",
4645
]
@@ -561,8 +560,9 @@ def run(
561560
def output(self, data):
562561
if isinstance(data, (list, tuple)):
563562
data = "\n".join(data)
564-
data = data.replace("\r\n", "\n").replace("\r", "\n")
565-
self.output_view.run_command("latextools_do_output_edit", {"data": data})
563+
self.output_view.run_command(
564+
"append", {"characters": data, "force": True, "scroll_to_end": True}
565+
)
566566

567567
def show_output_panel(self, force=False):
568568
if force or self.hide_panel_level != "always":
@@ -703,18 +703,6 @@ def hide_annotations(self):
703703
self.show_errors_inline = False
704704

705705

706-
class LatextoolsDoOutputEditCommand(sublime_plugin.TextCommand):
707-
def run(self, edit, data):
708-
view = self.view
709-
sel = view.sel()
710-
sel_at_end = len(sel) == 1 and sel[0].end() == view.size()
711-
view.set_read_only(False)
712-
view.insert(edit, view.size(), data)
713-
view.set_read_only(True)
714-
if sel_at_end:
715-
view.show(view.size())
716-
717-
718706
class LatextoolsDoFinishEditCommand(sublime_plugin.TextCommand):
719707
def run(self, edit):
720708
self.view.sel().clear()

plugin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
)
9090
from .latextools.make_pdf import (
9191
LatextoolsMakePdfCommand,
92-
LatextoolsDoOutputEditCommand,
9392
LatextoolsDoFinishEditCommand,
9493
LatextoolsExecEventListener,
9594
)

0 commit comments

Comments
 (0)