comparison 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
comparison
equal deleted inserted replaced
17850:513f2890d474 17851:ba63a184e6b6
73 static int diff_buf_idx(buf_T *buf); 73 static int diff_buf_idx(buf_T *buf);
74 static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp); 74 static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp);
75 static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T line2, long amount, long amount_after); 75 static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T line2, long amount, long amount_after);
76 static void diff_check_unchanged(tabpage_T *tp, diff_T *dp); 76 static void diff_check_unchanged(tabpage_T *tp, diff_T *dp);
77 static int diff_check_sanity(tabpage_T *tp, diff_T *dp); 77 static int diff_check_sanity(tabpage_T *tp, diff_T *dp);
78 static void diff_redraw(int dofold);
79 static int check_external_diff(diffio_T *diffio); 78 static int check_external_diff(diffio_T *diffio);
80 static int diff_file(diffio_T *diffio); 79 static int diff_file(diffio_T *diffio);
81 static int diff_equal_entry(diff_T *dp, int idx1, int idx2); 80 static int diff_equal_entry(diff_T *dp, int idx1, int idx2);
82 static int diff_cmp(char_u *s1, char_u *s2); 81 static int diff_cmp(char_u *s1, char_u *s2);
83 #ifdef FEAT_FOLDING 82 #ifdef FEAT_FOLDING
518 517
519 } 518 }
520 519
521 if (tp == curtab) 520 if (tp == curtab)
522 { 521 {
523 diff_redraw(TRUE); 522 // Don't redraw right away, this updates the diffs, which can be slow.
523 need_diff_redraw = TRUE;
524 524
525 /* Need to recompute the scroll binding, may remove or add filler 525 /* Need to recompute the scroll binding, may remove or add filler
526 * lines (e.g., when adding lines above w_topline). But it's slow when 526 * lines (e.g., when adding lines above w_topline). But it's slow when
527 * making many changes, postpone until redrawing. */ 527 * making many changes, postpone until redrawing. */
528 diff_need_scrollbind = TRUE; 528 diff_need_scrollbind = TRUE;
643 } 643 }
644 644
645 /* 645 /*
646 * Mark all diff buffers in the current tab page for redraw. 646 * Mark all diff buffers in the current tab page for redraw.
647 */ 647 */
648 static void 648 void
649 diff_redraw( 649 diff_redraw(
650 int dofold) // also recompute the folds 650 int dofold) // also recompute the folds
651 { 651 {
652 win_T *wp; 652 win_T *wp;
653 int n; 653 int n;
654 654
655 need_diff_redraw = FALSE;
655 FOR_ALL_WINDOWS(wp) 656 FOR_ALL_WINDOWS(wp)
656 if (wp->w_p_diff) 657 if (wp->w_p_diff)
657 { 658 {
658 redraw_win_later(wp, SOME_VALID); 659 redraw_win_later(wp, SOME_VALID);
659 #ifdef FEAT_FOLDING 660 #ifdef FEAT_FOLDING