diff src/diff.c @ 17851:ba63a184e6b6 v8.1.1922

patch 8.1.1922: in diff mode global operations can be very slow Commit: https://github.com/vim/vim/commit/4f57eefe1e84b5a90e08474092ea6fc8825ad5c9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 24 20:54:19 2019 +0200 patch 8.1.1922: in diff mode global operations can be very slow 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Aug 2019 21:00:06 +0200
parents ce04ebdf26b8
children 5c8906f653f5
line wrap: on
line diff
--- a/src/diff.c
+++ b/src/diff.c
@@ -75,7 +75,6 @@ static int diff_buf_idx_tp(buf_T *buf, t
 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 
 /*
  * 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)
 	{