mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
vim-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.
4f57eefe1e
This commit is contained in:
@@ -490,7 +490,8 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tp == curtab) {
|
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
|
// 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
|
// lines (e.g., when adding lines above w_topline). But it's slow when
|
||||||
@@ -634,8 +635,9 @@ static int diff_check_sanity(tabpage_T *tp, diff_T *dp)
|
|||||||
/// Mark all diff buffers in the current tab page for redraw.
|
/// Mark all diff buffers in the current tab page for redraw.
|
||||||
///
|
///
|
||||||
/// @param dofold Also recompute the folds
|
/// @param dofold Also recompute the folds
|
||||||
static void diff_redraw(int dofold)
|
void diff_redraw(bool dofold)
|
||||||
{
|
{
|
||||||
|
need_diff_redraw = false;
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
if (!wp->w_p_diff) {
|
if (!wp->w_p_diff) {
|
||||||
continue;
|
continue;
|
||||||
|
@@ -771,6 +771,11 @@ void foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (need_diff_redraw) {
|
||||||
|
// will update later
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Mark all folds from top to bot as maybe-small.
|
// Mark all folds from top to bot as maybe-small.
|
||||||
fold_T *fp;
|
fold_T *fp;
|
||||||
(void)foldFind(&wp->w_folds, top, &fp);
|
(void)foldFind(&wp->w_folds, top, &fp);
|
||||||
|
@@ -744,6 +744,7 @@ EXTERN int maptick INIT(= 0); // tick for each non-mapped char
|
|||||||
EXTERN int must_redraw INIT(= 0); // type of redraw necessary
|
EXTERN int must_redraw INIT(= 0); // type of redraw necessary
|
||||||
EXTERN bool skip_redraw INIT(= false); // skip redraw once
|
EXTERN bool skip_redraw INIT(= false); // skip redraw once
|
||||||
EXTERN bool do_redraw INIT(= false); // extra redraw once
|
EXTERN bool do_redraw INIT(= false); // extra redraw once
|
||||||
|
EXTERN bool need_diff_redraw INIT(= false); // need to call diff_redraw()
|
||||||
EXTERN bool must_redraw_pum INIT(= false); // redraw pum. NB: must_redraw
|
EXTERN bool must_redraw_pum INIT(= false); // redraw pum. NB: must_redraw
|
||||||
// should also be set.
|
// should also be set.
|
||||||
|
|
||||||
|
@@ -286,6 +286,11 @@ int update_screen(int type)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// May have postponed updating diffs.
|
||||||
|
if (need_diff_redraw) {
|
||||||
|
diff_redraw(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (must_redraw) {
|
if (must_redraw) {
|
||||||
if (type < must_redraw) /* use maximal type */
|
if (type < must_redraw) /* use maximal type */
|
||||||
type = must_redraw;
|
type = must_redraw;
|
||||||
|
Reference in New Issue
Block a user