aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/move.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-09-13 00:34:28 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-09-13 01:08:12 +0200
commitba27284f0773dcd4069b5715a4b07a4e1fa7c0aa (patch)
treee11f310b8c587d8509dc40c4756eb03f058a296f /src/nvim/move.c
parente7a9c76ab054d67de1eaa71c60f282161e8a0aa6 (diff)
downloadrneovim-ba27284f0773dcd4069b5715a4b07a4e1fa7c0aa.tar.gz
rneovim-ba27284f0773dcd4069b5715a4b07a4e1fa7c0aa.tar.bz2
rneovim-ba27284f0773dcd4069b5715a4b07a4e1fa7c0aa.zip
vim-patch:8.1.0374: moving the cursor is slow when 'relativenumber' is set
Problem: Moving the cursor is slow when 'relativenumber' is set. Solution: Only redraw the number column, not all lines. https://github.com/vim/vim/commit/bd9a53c06c8869ad811cb3dd01a309c9be7d7a63
Diffstat (limited to 'src/nvim/move.c')
-rw-r--r--src/nvim/move.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/nvim/move.c b/src/nvim/move.c
index 9dccca092a..4a2874abeb 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -104,17 +104,23 @@ 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()) {
- 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);
+ if (wp->w_p_rnu) {
+ // win_line() will redraw the number column only.
redraw_win_later(wp, VALID);
- } else {
- redraw_win_later(wp, SOME_VALID);
}
- last_cursorline = wp->w_cursor.lnum;
+ if (wp->w_p_cul) {
+ if (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);
+ redraw_win_later(wp, VALID);
+ } else {
+ redraw_win_later(wp, SOME_VALID);
+ }
+ last_cursorline = wp->w_cursor.lnum;
+ }
}
}