0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-08-24 20:54:19 +02:00
parent a4208966fb
commit 4f57eefe1e
6 changed files with 21 additions and 3 deletions

View File

@@ -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)
{