From 45862c618d01ee223e9954f63b57504f1610ae2e Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 30 Jun 2019 00:48:14 +0200 Subject: [PATCH] Make Inline diff refresh run on worker thread --- core/commands/inline_diff.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/commands/inline_diff.py b/core/commands/inline_diff.py index bec1abf4c..d4c35e915 100644 --- a/core/commands/inline_diff.py +++ b/core/commands/inline_diff.py @@ -145,6 +145,9 @@ class GsInlineDiffRefreshCommand(TextCommand, GitCommand): """ def run(self, edit): + sublime.set_timeout_async(self.run_async, 0) + + def run_async(self): file_path = self.file_path in_cached_mode = self.view.settings().get("git_savvy.inline_diff_view.in_cached_mode") ignore_eol_arg = ( @@ -181,7 +184,10 @@ def run(self, edit): row, col = self.view.rowcol(cursors[0].begin()) self.view.set_read_only(False) - self.view.replace(edit, sublime.Region(0, self.view.size()), inline_diff_contents) + self.view.run_command("gs_replace_view_text", { + "text": inline_diff_contents, + "restore_cursors": True, + }) if cursors: if (row, col) == (0, 0) and self.savvy_settings.get("inline_diff_auto_scroll", False):