summaryrefslogtreecommitdiffstats
path: root/src/move.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-09-12 23:15:48 +0200
committerBram Moolenaar <Bram@vim.org>2018-09-12 23:15:48 +0200
commitbd9a53c06c8869ad811cb3dd01a309c9be7d7a63 (patch)
tree236d836cac1ea87684c45c469e76bf59538520d6 /src/move.c
parent1b7fefcbce5dd2fd337e217d4857b941da3f8bed (diff)
patch 8.1.0374: moving the cursor is slow when 'relativenumber' is setv8.1.0374
Problem: Moving the cursor is slow when 'relativenumber' is set. Solution: Only redraw the number column, not all lines.
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/move.c b/src/move.c
index 120ee5a556..e9a3eb971e 100644
--- a/src/move.c
+++ b/src/move.c
@@ -145,21 +145,25 @@ redraw_for_cursorline(win_T *wp)
# endif
)
{
+ if (wp->w_p_rnu)
+ // win_line() will redraw the number column only.
+ redraw_win_later(wp, VALID);
#ifdef FEAT_SYN_HL
- if (!wp->w_p_rnu && wp->w_redr_type <= VALID && last_cursorline != 0)
+ if (wp->w_p_cul)
{
- // "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);
+ 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;
}
- else
-#endif
- redraw_win_later(wp, SOME_VALID);
-#ifdef FEAT_SYN_HL
- last_cursorline = wp->w_cursor.lnum;
#endif
}
}