diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-24 20:54:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-24 20:54:19 +0200 |
commit | 4f57eefe1e84b5a90e08474092ea6fc8825ad5c9 (patch) | |
tree | 5afd78a40e21a0375a423acbf3ef990e32ac0cd6 /src/diff.c | |
parent | a4208966fb289a505ebdef62bbc37c214069bab4 (diff) | |
download | vim-git-4f57eefe1e84b5a90e08474092ea6fc8825ad5c9.tar.gz |
patch 8.1.1922: in diff mode global operations can be very slowv8.1.1922
Problem: In diff mode global operations can be very slow.
Solution: Do not call diff_redraw() many times, call it once when redrawing.
And also don't update folds multiple times.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/diff.c b/src/diff.c index 260fdd96d..4c0041d41 100644 --- a/src/diff.c +++ b/src/diff.c @@ -75,7 +75,6 @@ static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp); static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T line2, long amount, long amount_after); static void diff_check_unchanged(tabpage_T *tp, diff_T *dp); static int diff_check_sanity(tabpage_T *tp, diff_T *dp); -static void diff_redraw(int dofold); static int check_external_diff(diffio_T *diffio); static int diff_file(diffio_T *diffio); static int diff_equal_entry(diff_T *dp, int idx1, int idx2); @@ -520,7 +519,8 @@ diff_mark_adjust_tp( if (tp == curtab) { - diff_redraw(TRUE); + // Don't redraw right away, this updates the diffs, which can be slow. + need_diff_redraw = TRUE; /* Need to recompute the scroll binding, may remove or add filler * lines (e.g., when adding lines above w_topline). But it's slow when @@ -645,13 +645,14 @@ diff_check_sanity(tabpage_T *tp, diff_T *dp) /* * Mark all diff buffers in the current tab page for redraw. */ - static void + void diff_redraw( int dofold) // also recompute the folds { win_T *wp; int n; + need_diff_redraw = FALSE; FOR_ALL_WINDOWS(wp) if (wp->w_p_diff) { |