mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 8.1.0372: screen updating slow when 'cursorline' is set
Problem: Screen updating slow when 'cursorline' is set. Solution: Only redraw the old and new cursor line, not all lines.
This commit is contained in:
@@ -1966,7 +1966,7 @@ edit_unputchar(void)
|
|||||||
if (pc_status == PC_STATUS_RIGHT)
|
if (pc_status == PC_STATUS_RIGHT)
|
||||||
++curwin->w_wcol;
|
++curwin->w_wcol;
|
||||||
if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT)
|
if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT)
|
||||||
redrawWinline(curwin->w_cursor.lnum, FALSE);
|
redrawWinline(curwin, curwin->w_cursor.lnum, FALSE);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
screen_puts(pc_bytes, pc_row - msg_scrolled, pc_col, pc_attr);
|
screen_puts(pc_bytes, pc_row - msg_scrolled, pc_col, pc_attr);
|
||||||
@@ -2017,7 +2017,7 @@ undisplay_dollar(void)
|
|||||||
if (dollar_vcol >= 0)
|
if (dollar_vcol >= 0)
|
||||||
{
|
{
|
||||||
dollar_vcol = -1;
|
dollar_vcol = -1;
|
||||||
redrawWinline(curwin->w_cursor.lnum, FALSE);
|
redrawWinline(curwin, curwin->w_cursor.lnum, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7079,7 +7079,7 @@ check_spell_redraw(void)
|
|||||||
linenr_T lnum = spell_redraw_lnum;
|
linenr_T lnum = spell_redraw_lnum;
|
||||||
|
|
||||||
spell_redraw_lnum = 0;
|
spell_redraw_lnum = 0;
|
||||||
redrawWinline(lnum, FALSE);
|
redrawWinline(curwin, lnum, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
src/move.c
19
src/move.c
@@ -123,6 +123,10 @@ comp_botline(win_T *wp)
|
|||||||
set_empty_rows(wp, done);
|
set_empty_rows(wp, done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
static linenr_T last_cursorline = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is
|
* Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is
|
||||||
* set.
|
* set.
|
||||||
@@ -140,7 +144,22 @@ redraw_for_cursorline(win_T *wp)
|
|||||||
&& !pum_visible()
|
&& !pum_visible()
|
||||||
# endif
|
# endif
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
if (!wp->w_p_rnu && wp->w_redr_type <= VALID && last_cursorline != 0)
|
||||||
|
{
|
||||||
|
// "last_cursorline" may be set for another window, worst case we
|
||||||
|
// redraw too much. This is optimized for moving the cursor around
|
||||||
|
// in the same window.
|
||||||
|
redrawWinline(wp, last_cursorline, FALSE);
|
||||||
|
redrawWinline(wp, wp->w_cursor.lnum, FALSE);
|
||||||
|
last_cursorline = wp->w_cursor.lnum;
|
||||||
|
redraw_win_later(wp, VALID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
redraw_win_later(wp, SOME_VALID);
|
redraw_win_later(wp, SOME_VALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -8,7 +8,7 @@ void redraw_buf_later(buf_T *buf, int type);
|
|||||||
void redraw_buf_and_status_later(buf_T *buf, int type);
|
void redraw_buf_and_status_later(buf_T *buf, int type);
|
||||||
int redraw_asap(int type);
|
int redraw_asap(int type);
|
||||||
void redraw_after_callback(int call_update_screen);
|
void redraw_after_callback(int call_update_screen);
|
||||||
void redrawWinline(linenr_T lnum, int invalid);
|
void redrawWinline(win_T *wp, linenr_T lnum, int invalid);
|
||||||
void reset_updating_screen(int may_resize_shell);
|
void reset_updating_screen(int may_resize_shell);
|
||||||
void update_curbuf(int type);
|
void update_curbuf(int type);
|
||||||
int update_screen(int type_arg);
|
int update_screen(int type_arg);
|
||||||
|
15
src/screen.c
15
src/screen.c
@@ -496,6 +496,7 @@ redraw_after_callback(int call_update_screen)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
redrawWinline(
|
redrawWinline(
|
||||||
|
win_T *wp,
|
||||||
linenr_T lnum,
|
linenr_T lnum,
|
||||||
int invalid UNUSED) /* window line height is invalid now */
|
int invalid UNUSED) /* window line height is invalid now */
|
||||||
{
|
{
|
||||||
@@ -503,19 +504,19 @@ redrawWinline(
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (curwin->w_redraw_top == 0 || curwin->w_redraw_top > lnum)
|
if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum)
|
||||||
curwin->w_redraw_top = lnum;
|
wp->w_redraw_top = lnum;
|
||||||
if (curwin->w_redraw_bot == 0 || curwin->w_redraw_bot < lnum)
|
if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum)
|
||||||
curwin->w_redraw_bot = lnum;
|
wp->w_redraw_bot = lnum;
|
||||||
redraw_later(VALID);
|
redraw_win_later(wp, VALID);
|
||||||
|
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
if (invalid)
|
if (invalid)
|
||||||
{
|
{
|
||||||
/* A w_lines[] entry for this lnum has become invalid. */
|
/* A w_lines[] entry for this lnum has become invalid. */
|
||||||
i = find_wl_entry(curwin, lnum);
|
i = find_wl_entry(wp, lnum);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
curwin->w_lines[i].wl_valid = FALSE;
|
wp->w_lines[i].wl_valid = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -794,6 +794,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 */
|
||||||
|
/**/
|
||||||
|
372,
|
||||||
/**/
|
/**/
|
||||||
371,
|
371,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user