From 7c208dc36c56aa94b5e097579d976386e46d4809 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 19 Jun 2019 11:42:49 +0200 Subject: [PATCH 1/2] Skip inline diff wording when > 10 000 hunk fix: #1133 --- common/util/diff_string.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/util/diff_string.py b/common/util/diff_string.py index b7523248d..ed146b67e 100644 --- a/common/util/diff_string.py +++ b/common/util/diff_string.py @@ -28,6 +28,13 @@ def get_indices(chunks): def get_changes(old, new): + # if one of the inputs, either old or new is more then 10 000 characters + # we skip tring to find the words which changed. If a hunk is more than + # 10 000 charachers it is most likly a generated change. + # We skip since this calculation take a lot of time then it gets bigger. + if max(len(old), len(new)) > 10000: + return [] + old_chunks = tuple(filter(lambda x: x, boundary.split(old))) new_chunks = tuple(filter(lambda x: x, boundary.split(new))) old_indices = get_indices(old_chunks) From 5a3a6f725555d08677a236f583019a7949e0f085 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 30 Jun 2019 00:15:12 +0200 Subject: [PATCH 2/2] Make Inline diff refresh run on worker thread --- core/commands/inline_diff.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/commands/inline_diff.py b/core/commands/inline_diff.py index bec1abf4c..9639fc98b 100644 --- a/core/commands/inline_diff.py +++ b/core/commands/inline_diff.py @@ -144,7 +144,10 @@ class GsInlineDiffRefreshCommand(TextCommand, GitCommand): are not supported in `cached` mode. """ - def run(self, edit): + def run(self, **kwargs): + sublime.set_timeout_async(lambda: self.run_async(**kwargs), 0) + + def run_async(self, edit): file_path = self.file_path in_cached_mode = self.view.settings().get("git_savvy.inline_diff_view.in_cached_mode") ignore_eol_arg = (