diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-09-12 21:52:18 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-09-12 21:52:18 +0200 |
commit | 90a997987dbbe43af3c15118a35f658f0f037d1d (patch) | |
tree | 53f3974a235a4bc9c0a266fde3c5e86d5fde5ac6 /src/move.c | |
parent | 643b6140873e0e6f297df0cbca11bc1ea1f21925 (diff) | |
download | vim-git-90a997987dbbe43af3c15118a35f658f0f037d1d.tar.gz |
patch 8.1.0372: screen updating slow when 'cursorline' is setv8.1.0372
Problem: Screen updating slow when 'cursorline' is set.
Solution: Only redraw the old and new cursor line, not all lines.
Diffstat (limited to 'src/move.c')
-rw-r--r-- | src/move.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/move.c b/src/move.c index b2b84868a..68f8ae4a4 100644 --- a/src/move.c +++ b/src/move.c @@ -123,6 +123,10 @@ comp_botline(win_T *wp) 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 * set. @@ -140,7 +144,22 @@ redraw_for_cursorline(win_T *wp) && !pum_visible() # endif ) - redraw_win_later(wp, SOME_VALID); + { +#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); + } } /* |