Skip to content

Commit

Permalink
Merge 4e4feb3 into 3cd3b9c
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Feb 14, 2019
2 parents 3cd3b9c + 4e4feb3 commit ddd5d0a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/commands/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ class GsDiffStageOrResetHunkCommand(TextCommand, GitCommand):
hunk under the user's cursor(s).
"""

# NOTE: The whole command (including the view refresh) must be blocking otherwise
# the view and the repo state get out of sync and e.g. hitting 'h' very fast will
# result in errors.

def run(self, edit, reset=False):
ignore_whitespace = self.view.settings().get("git_savvy.diff_view.ignore_whitespace")
show_word_diff = self.view.settings().get("git_savvy.diff_view.show_word_diff")
Expand All @@ -384,7 +388,7 @@ def run(self, edit, reset=False):
set((self.view.size() + 1, ))
))

sublime.set_timeout_async(lambda: self.apply_diffs_for_pts(cursor_pts, reset), 0)
self.apply_diffs_for_pts(cursor_pts, reset)

def apply_diffs_for_pts(self, cursor_pts, reset):
in_cached_mode = self.view.settings().get("git_savvy.diff_view.in_cached_mode")
Expand Down Expand Up @@ -427,7 +431,7 @@ def apply_diffs_for_pts(self, cursor_pts, reset):
self.view.settings().set("git_savvy.diff_view.history", history)
self.view.settings().set("git_savvy.diff_view.just_hunked", hunk_diff)

sublime.set_timeout_async(lambda: self.view.run_command("gs_diff_refresh"))
self.view.run_command("gs_diff_refresh")

def get_hunk_diff(self, pt):
"""
Expand Down

0 comments on commit ddd5d0a

Please sign in to comment.