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) 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 = (