0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B

Problem:    Redrawing a vertically split window is slow when using CTRL-F and
            CTRL-B.
Solution:   When deciding on USE_REDRAW bail out if scrolling more than three
            lines. (issue #8002)
This commit is contained in:
Bram Moolenaar 2022-04-03 13:23:22 +01:00
parent ce416b453a
commit 8ef6997e2d
2 changed files with 19 additions and 1 deletions

View File

@ -3707,7 +3707,15 @@ screen_ins_lines(
*/ */
result_empty = (row + line_count >= end); result_empty = (row + line_count >= end);
if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
{
// Avoid that lines are first cleared here and then redrawn, which
// results in many characters updated twice. This happens with CTRL-F
// in a vertically split window. With line-by-line scrolling
// USE_REDRAW should be faster.
if (line_count > 3)
return FAIL;
type = USE_REDRAW; type = USE_REDRAW;
}
else if (can_clear(T_CD) && result_empty) else if (can_clear(T_CD) && result_empty)
type = USE_T_CD; type = USE_T_CD;
else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL)) else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL))
@ -3879,7 +3887,7 @@ screen_del_lines(
int end, int end,
int force, // even when line_count > p_ttyscroll int force, // even when line_count > p_ttyscroll
int clear_attr, // used for clearing lines int clear_attr, // used for clearing lines
win_T *wp UNUSED) // NULL or window to use width from win_T *wp) // NULL or window to use width from
{ {
int j; int j;
int i; int i;
@ -3934,7 +3942,15 @@ screen_del_lines(
* 6. redraw the characters from ScreenLines[]. * 6. redraw the characters from ScreenLines[].
*/ */
if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
{
// Avoid that lines are first cleared here and then redrawn, which
// results in many characters updated twice. This happens with CTRL-F
// in a vertically split window. With line-by-line scrolling
// USE_REDRAW should be faster.
if (line_count > 3)
return FAIL;
type = USE_REDRAW; type = USE_REDRAW;
}
else if (can_clear(T_CD) && result_empty) else if (can_clear(T_CD) && result_empty)
type = USE_T_CD; type = USE_T_CD;
else if (row == 0 && ( else if (row == 0 && (

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4673,
/**/ /**/
4672, 4672,
/**/ /**/