On Do, 24 Okt 2019, Bram Moolenaar wrote:

> Patch 8.1.2214
> Problem:    Too much is redrawn when 'cursorline' is set.
> Solution:   Don't do a complete redraw. (closes #5079)

Hm, we also do redraw too much, if line numbering is turned on
and cursorline option is set and cursorlineopt=number

I think this can be also be optimized. That would need a patch similar 
to this one:

diff --git a/src/drawscreen.c b/src/drawscreen.c
index abf34b5e9..2040c77d4 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -2127,7 +2127,8 @@ win_update(win_T *wp)
                                ))))
 #ifdef FEAT_SYN_HL
                || (wp->w_p_cul && (lnum == wp->w_cursor.lnum
-                                            || lnum == wp->w_last_cursorline))
+                                            || lnum == wp->w_last_cursorline)
+                       && !(wp->w_p_culopt_flags == CULOPT_NBR))
 #endif
                                )
        {
@@ -2387,7 +2388,7 @@ win_update(win_T *wp)
        }
        else
        {
-           if (wp->w_p_rnu)
+           if (wp->w_p_rnu || (wp->w_p_cul && wp->w_p_culopt_flags == 
CULOPT_NBR))
            {
 #ifdef FEAT_FOLDING
                // 'relativenumber' set: The text doesn't need to be drawn, but


And then this ugly change to drawline.c:

diff --git a/src/drawline.c b/src/drawline.c
index 869bdaa0e..bd3d42c86 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1267,13 +1267,12 @@ win_line(
        // When still displaying '$' of change command, stop at cursor.
        // When only displaying the (relative) line number and that's done,
        // stop here.
-       if ((dollar_vcol >= 0 && wp == curwin
+       if (dollar_vcol >= 0 && wp == curwin
                   && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
 #ifdef FEAT_DIFF
                                   && filler_todo <= 0
 #endif
                )
-               || (number_only && draw_state > WL_NR))
        {
            screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width,
                                                            screen_line_flags);
@@ -1288,6 +1287,25 @@ win_line(
            break;
        }

+       if (number_only && draw_state > WL_NR)
+       {
+           screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width,
+                                                           screen_line_flags);
+           if (wp->w_p_wrap && (wp->w_p_nu || wp->w_p_rnu) && HL_ATTR(HLF_CLN) 
!= 0)
+           {
+               ++row;
+               ++screen_row;
+               // need to redraw the number column with the right highlighting 
attribute
+               // for the start of the next screen row.
+               // Pretend to be done with the first line, wrap around now.
+               goto wrap_around;
+           }
+           else
+               // break out of the loop after having redrawn the number column
+               break;
+       }
+
+
        if (draw_state == WL_LINE && (area_highlighting || extra_check))
        {
            // handle Visual or match highlighting in this line
@@ -3007,6 +3025,7 @@ win_line(
                row = endrow;
            }

+wrap_around:
            // When line got too long for screen break here.
            if (row == endrow)
            {
@@ -3018,7 +3037,7 @@ win_line(
 #ifdef FEAT_DIFF
                     && filler_todo <= 0
 #endif
-                    && wp->w_width == Columns)
+                    && wp->w_width == Columns && !number_only)
            {
                // Remember that the line wraps, used for modeless copy.
                LineWraps[screen_row - 1] = TRUE;

Is that too specific optimization for a too bizare use-case? Or would it make 
sense to include that?


Best,
Christian
-- 
Das Leben hat keinen Sinn, außer dem, den wir ihm geben. Es ermutigt
den Menschen nicht, noch demütigt es ihn.
                -- Thornton Niven Wilder

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20191024212002.GF26491%40256bit.org.

Raspunde prin e-mail lui