aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/move.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-09-12 23:06:26 +0200
committerGitHub <noreply@github.com>2018-09-12 23:06:26 +0200
commit7a26b9b62b5c5c69b4ea700eb8541721a763e734 (patch)
treecb9e061b24ca1229a591a33e801c09e02afbb11f /src/nvim/move.c
parent9124bb755c410386efd3f030e54b2fbbe3fec193 (diff)
downloadrneovim-7a26b9b62b5c5c69b4ea700eb8541721a763e734.tar.gz
rneovim-7a26b9b62b5c5c69b4ea700eb8541721a763e734.tar.bz2
rneovim-7a26b9b62b5c5c69b4ea700eb8541721a763e734.zip
vim-patch:8.1.0372: screen updating slow when 'cursorline' is set (#8986)
Problem: Screen updating slow when 'cursorline' is set. Solution: Only redraw the old and new cursor line, not all lines. https://github.com/vim/vim/commit/90a997987dbbe43af3c15118a35f658f0f037d1d
Diffstat (limited to 'src/nvim/move.c')
-rw-r--r--src/nvim/move.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 1b84628ebc..be7a8f43ec 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -96,16 +96,25 @@ static void comp_botline(win_T *wp)
set_empty_rows(wp, done);
}
-/*
-* Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is
-* set.
-*/
+static linenr_T last_cursorline = 0;
+
+// Redraw when w_cline_row changes and 'relativenumber' or 'cursorline' is set.
static void redraw_for_cursorline(win_T *wp)
{
if ((wp->w_p_rnu || wp->w_p_cul)
&& (wp->w_valid & VALID_CROW) == 0
&& !pum_visible()) {
- redraw_win_later(wp, SOME_VALID);
+ 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 {
+ redraw_win_later(wp, SOME_VALID);
+ }
}
}