Mercurial > vim
diff src/move.c @ 14724:90de24a1e9b7 v8.1.0374
patch 8.1.0374: moving the cursor is slow when 'relativenumber' is set
commit https://github.com/vim/vim/commit/bd9a53c06c8869ad811cb3dd01a309c9be7d7a63
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 12 23:15:48 2018 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 12 Sep 2018 23:30:06 +0200 |
parents | 9b150311eb9c |
children | 10107703b9b2 |
line wrap: on
line diff
--- 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 } }