Mercurial > vim
comparison src/screen.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 | a9665096074b |
children | 21626570ea46 |
comparison
equal
deleted
inserted
replaced
14723:9687fadbf083 | 14724:90de24a1e9b7 |
---|---|
130 #ifdef FEAT_FOLDING | 130 #ifdef FEAT_FOLDING |
131 static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row); | 131 static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row); |
132 static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); | 132 static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); |
133 static void copy_text_attr(int off, char_u *buf, int len, int attr); | 133 static void copy_text_attr(int off, char_u *buf, int len, int attr); |
134 #endif | 134 #endif |
135 static int win_line(win_T *, linenr_T, int, int, int nochange); | 135 static int win_line(win_T *, linenr_T, int, int, int nochange, int number_only); |
136 static int char_needs_redraw(int off_from, int off_to, int cols); | 136 static int char_needs_redraw(int off_from, int off_to, int cols); |
137 static void draw_vsep_win(win_T *wp, int row); | 137 static void draw_vsep_win(win_T *wp, int row); |
138 #ifdef FEAT_STL_OPT | 138 #ifdef FEAT_STL_OPT |
139 static void redraw_custom_statusline(win_T *wp); | 139 static void redraw_custom_statusline(win_T *wp); |
140 #endif | 140 #endif |
969 # ifdef FEAT_SEARCH_EXTRA | 969 # ifdef FEAT_SEARCH_EXTRA |
970 init_search_hl(wp); | 970 init_search_hl(wp); |
971 start_search_hl(); | 971 start_search_hl(); |
972 prepare_search_hl(wp, lnum); | 972 prepare_search_hl(wp, lnum); |
973 # endif | 973 # endif |
974 win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE); | 974 win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, |
975 FALSE, FALSE); | |
975 # if defined(FEAT_SEARCH_EXTRA) | 976 # if defined(FEAT_SEARCH_EXTRA) |
976 end_search_hl(); | 977 end_search_hl(); |
977 # endif | 978 # endif |
978 break; | 979 break; |
979 } | 980 } |
1879 srow = row; | 1880 srow = row; |
1880 | 1881 |
1881 /* | 1882 /* |
1882 * Update a line when it is in an area that needs updating, when it | 1883 * Update a line when it is in an area that needs updating, when it |
1883 * has changes or w_lines[idx] is invalid. | 1884 * has changes or w_lines[idx] is invalid. |
1884 * bot_start may be halfway a wrapped line after using | 1885 * "bot_start" may be halfway a wrapped line after using |
1885 * win_del_lines(), check if the current line includes it. | 1886 * win_del_lines(), check if the current line includes it. |
1886 * When syntax folding is being used, the saved syntax states will | 1887 * When syntax folding is being used, the saved syntax states will |
1887 * already have been updated, we can't see where the syntax state is | 1888 * already have been updated, we can't see where the syntax state is |
1888 * the same again, just update until the end of the window. | 1889 * the same again, just update until the end of the window. |
1889 */ | 1890 */ |
2138 #endif | 2139 #endif |
2139 | 2140 |
2140 /* | 2141 /* |
2141 * Display one line. | 2142 * Display one line. |
2142 */ | 2143 */ |
2143 row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0); | 2144 row = win_line(wp, lnum, srow, wp->w_height, |
2145 mod_top == 0, FALSE); | |
2144 | 2146 |
2145 #ifdef FEAT_FOLDING | 2147 #ifdef FEAT_FOLDING |
2146 wp->w_lines[idx].wl_folded = FALSE; | 2148 wp->w_lines[idx].wl_folded = FALSE; |
2147 wp->w_lines[idx].wl_lastlnum = lnum; | 2149 wp->w_lines[idx].wl_lastlnum = lnum; |
2148 #endif | 2150 #endif |
2175 ++lnum; | 2177 ++lnum; |
2176 #endif | 2178 #endif |
2177 } | 2179 } |
2178 else | 2180 else |
2179 { | 2181 { |
2180 /* This line does not need updating, advance to the next one */ | 2182 if (wp->w_p_rnu) |
2183 { | |
2184 // 'relativenumber' set: The text doesn't need to be drawn, but | |
2185 // the number column nearly always does. | |
2186 (void)win_line(wp, lnum, srow, wp->w_height, TRUE, TRUE); | |
2187 } | |
2188 | |
2189 // This line does not need to be drawn, advance to the next one. | |
2181 row += wp->w_lines[idx++].wl_size; | 2190 row += wp->w_lines[idx++].wl_size; |
2182 if (row > wp->w_height) /* past end of screen */ | 2191 if (row > wp->w_height) /* past end of screen */ |
2183 break; | 2192 break; |
2184 #ifdef FEAT_FOLDING | 2193 #ifdef FEAT_FOLDING |
2185 lnum = wp->w_lines[idx - 1].wl_lastlnum + 1; | 2194 lnum = wp->w_lines[idx - 1].wl_lastlnum + 1; |
3056 win_line( | 3065 win_line( |
3057 win_T *wp, | 3066 win_T *wp, |
3058 linenr_T lnum, | 3067 linenr_T lnum, |
3059 int startrow, | 3068 int startrow, |
3060 int endrow, | 3069 int endrow, |
3061 int nochange UNUSED) /* not updating for changed text */ | 3070 int nochange UNUSED, // not updating for changed text |
3071 int number_only) // only update the number column | |
3062 { | 3072 { |
3063 int col = 0; /* visual column on screen */ | 3073 int col = 0; /* visual column on screen */ |
3064 unsigned off; /* offset in ScreenLines/ScreenAttrs */ | 3074 unsigned off; /* offset in ScreenLines/ScreenAttrs */ |
3065 int c = 0; /* init for GCC */ | 3075 int c = 0; /* init for GCC */ |
3066 long vcol = 0; /* virtual column (for tabs) */ | 3076 long vcol = 0; /* virtual column (for tabs) */ |
3251 return startrow; | 3261 return startrow; |
3252 | 3262 |
3253 row = startrow; | 3263 row = startrow; |
3254 screen_row = row + W_WINROW(wp); | 3264 screen_row = row + W_WINROW(wp); |
3255 | 3265 |
3256 /* | 3266 if (!number_only) |
3257 * To speed up the loop below, set extra_check when there is linebreak, | 3267 { |
3258 * trailing white space and/or syntax processing to be done. | 3268 /* |
3259 */ | 3269 * To speed up the loop below, set extra_check when there is linebreak, |
3270 * trailing white space and/or syntax processing to be done. | |
3271 */ | |
3260 #ifdef FEAT_LINEBREAK | 3272 #ifdef FEAT_LINEBREAK |
3261 extra_check = wp->w_p_lbr; | 3273 extra_check = wp->w_p_lbr; |
3262 #else | 3274 #else |
3263 extra_check = 0; | 3275 extra_check = 0; |
3264 #endif | 3276 #endif |
3265 #ifdef FEAT_SYN_HL | 3277 #ifdef FEAT_SYN_HL |
3266 if (syntax_present(wp) && !wp->w_s->b_syn_error | 3278 if (syntax_present(wp) && !wp->w_s->b_syn_error |
3267 # ifdef SYN_TIME_LIMIT | 3279 # ifdef SYN_TIME_LIMIT |
3268 && !wp->w_s->b_syn_slow | 3280 && !wp->w_s->b_syn_slow |
3269 # endif | 3281 # endif |
3270 ) | 3282 ) |
3271 { | 3283 { |
3272 /* Prepare for syntax highlighting in this line. When there is an | 3284 /* Prepare for syntax highlighting in this line. When there is an |
3273 * error, stop syntax highlighting. */ | 3285 * error, stop syntax highlighting. */ |
3274 save_did_emsg = did_emsg; | 3286 save_did_emsg = did_emsg; |
3275 did_emsg = FALSE; | 3287 did_emsg = FALSE; |
3276 syntax_start(wp, lnum); | 3288 syntax_start(wp, lnum); |
3277 if (did_emsg) | 3289 if (did_emsg) |
3278 wp->w_s->b_syn_error = TRUE; | 3290 wp->w_s->b_syn_error = TRUE; |
3279 else | 3291 else |
3280 { | 3292 { |
3281 did_emsg = save_did_emsg; | 3293 did_emsg = save_did_emsg; |
3282 #ifdef SYN_TIME_LIMIT | 3294 #ifdef SYN_TIME_LIMIT |
3283 if (!wp->w_s->b_syn_slow) | 3295 if (!wp->w_s->b_syn_slow) |
3284 #endif | 3296 #endif |
3285 { | 3297 { |
3286 has_syntax = TRUE; | 3298 has_syntax = TRUE; |
3287 extra_check = TRUE; | 3299 extra_check = TRUE; |
3288 } | 3300 } |
3289 } | 3301 } |
3290 } | 3302 } |
3291 | 3303 |
3292 /* Check for columns to display for 'colorcolumn'. */ | 3304 /* Check for columns to display for 'colorcolumn'. */ |
3293 color_cols = wp->w_p_cc_cols; | 3305 color_cols = wp->w_p_cc_cols; |
3294 if (color_cols != NULL) | 3306 if (color_cols != NULL) |
3295 draw_color_col = advance_color_col(VCOL_HLC, &color_cols); | 3307 draw_color_col = advance_color_col(VCOL_HLC, &color_cols); |
3296 #endif | 3308 #endif |
3297 | 3309 |
3298 #ifdef FEAT_TERMINAL | 3310 #ifdef FEAT_TERMINAL |
3299 if (term_show_buffer(wp->w_buffer)) | 3311 if (term_show_buffer(wp->w_buffer)) |
3300 { | 3312 { |
3301 extra_check = TRUE; | 3313 extra_check = TRUE; |
3302 get_term_attr = TRUE; | 3314 get_term_attr = TRUE; |
3303 term_attr = term_get_attr(wp->w_buffer, lnum, -1); | 3315 term_attr = term_get_attr(wp->w_buffer, lnum, -1); |
3304 } | 3316 } |
3305 #endif | 3317 #endif |
3306 | 3318 |
3307 #ifdef FEAT_SPELL | 3319 #ifdef FEAT_SPELL |
3308 if (wp->w_p_spell | 3320 if (wp->w_p_spell |
3309 && *wp->w_s->b_p_spl != NUL | 3321 && *wp->w_s->b_p_spl != NUL |
3310 && wp->w_s->b_langp.ga_len > 0 | 3322 && wp->w_s->b_langp.ga_len > 0 |
3311 && *(char **)(wp->w_s->b_langp.ga_data) != NULL) | 3323 && *(char **)(wp->w_s->b_langp.ga_data) != NULL) |
3312 { | 3324 { |
3313 /* Prepare for spell checking. */ | 3325 /* Prepare for spell checking. */ |
3314 has_spell = TRUE; | 3326 has_spell = TRUE; |
3315 extra_check = TRUE; | 3327 extra_check = TRUE; |
3316 | 3328 |
3317 /* Get the start of the next line, so that words that wrap to the next | 3329 /* Get the start of the next line, so that words that wrap to the next |
3318 * line are found too: "et<line-break>al.". | 3330 * line are found too: "et<line-break>al.". |
3319 * Trick: skip a few chars for C/shell/Vim comments */ | 3331 * Trick: skip a few chars for C/shell/Vim comments */ |
3320 nextline[SPWORDLEN] = NUL; | 3332 nextline[SPWORDLEN] = NUL; |
3321 if (lnum < wp->w_buffer->b_ml.ml_line_count) | 3333 if (lnum < wp->w_buffer->b_ml.ml_line_count) |
3322 { | 3334 { |
3323 line = ml_get_buf(wp->w_buffer, lnum + 1, FALSE); | 3335 line = ml_get_buf(wp->w_buffer, lnum + 1, FALSE); |
3324 spell_cat_line(nextline + SPWORDLEN, line, SPWORDLEN); | 3336 spell_cat_line(nextline + SPWORDLEN, line, SPWORDLEN); |
3325 } | 3337 } |
3326 | 3338 |
3327 /* When a word wrapped from the previous line the start of the current | 3339 /* When a word wrapped from the previous line the start of the current |
3328 * line is valid. */ | 3340 * line is valid. */ |
3329 if (lnum == checked_lnum) | 3341 if (lnum == checked_lnum) |
3330 cur_checked_col = checked_col; | 3342 cur_checked_col = checked_col; |
3331 checked_lnum = 0; | 3343 checked_lnum = 0; |
3332 | 3344 |
3333 /* When there was a sentence end in the previous line may require a | 3345 /* When there was a sentence end in the previous line may require a |
3334 * word starting with capital in this line. In line 1 always check | 3346 * word starting with capital in this line. In line 1 always check |
3335 * the first word. */ | 3347 * the first word. */ |
3336 if (lnum != capcol_lnum) | 3348 if (lnum != capcol_lnum) |
3337 cap_col = -1; | 3349 cap_col = -1; |
3338 if (lnum == 1) | 3350 if (lnum == 1) |
3339 cap_col = 0; | 3351 cap_col = 0; |
3340 capcol_lnum = 0; | 3352 capcol_lnum = 0; |
3341 } | 3353 } |
3342 #endif | 3354 #endif |
3343 | 3355 |
3344 /* | 3356 /* |
3345 * handle visual active in this window | 3357 * handle visual active in this window |
3346 */ | 3358 */ |
3347 fromcol = -10; | 3359 fromcol = -10; |
3348 tocol = MAXCOL; | 3360 tocol = MAXCOL; |
3349 if (VIsual_active && wp->w_buffer == curwin->w_buffer) | 3361 if (VIsual_active && wp->w_buffer == curwin->w_buffer) |
3350 { | 3362 { |
3351 /* Visual is after curwin->w_cursor */ | 3363 /* Visual is after curwin->w_cursor */ |
3352 if (LTOREQ_POS(curwin->w_cursor, VIsual)) | 3364 if (LTOREQ_POS(curwin->w_cursor, VIsual)) |
3353 { | 3365 { |
3354 top = &curwin->w_cursor; | 3366 top = &curwin->w_cursor; |
3355 bot = &VIsual; | 3367 bot = &VIsual; |
3356 } | 3368 } |
3357 else /* Visual is before curwin->w_cursor */ | 3369 else /* Visual is before curwin->w_cursor */ |
3358 { | 3370 { |
3359 top = &VIsual; | 3371 top = &VIsual; |
3360 bot = &curwin->w_cursor; | 3372 bot = &curwin->w_cursor; |
3361 } | 3373 } |
3362 lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum); | 3374 lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum); |
3363 if (VIsual_mode == Ctrl_V) /* block mode */ | 3375 if (VIsual_mode == Ctrl_V) /* block mode */ |
3364 { | 3376 { |
3365 if (lnum_in_visual_area) | 3377 if (lnum_in_visual_area) |
3366 { | 3378 { |
3367 fromcol = wp->w_old_cursor_fcol; | 3379 fromcol = wp->w_old_cursor_fcol; |
3368 tocol = wp->w_old_cursor_lcol; | 3380 tocol = wp->w_old_cursor_lcol; |
3369 } | 3381 } |
3370 } | 3382 } |
3371 else /* non-block mode */ | 3383 else /* non-block mode */ |
3372 { | 3384 { |
3373 if (lnum > top->lnum && lnum <= bot->lnum) | 3385 if (lnum > top->lnum && lnum <= bot->lnum) |
3374 fromcol = 0; | |
3375 else if (lnum == top->lnum) | |
3376 { | |
3377 if (VIsual_mode == 'V') /* linewise */ | |
3378 fromcol = 0; | 3386 fromcol = 0; |
3379 else | 3387 else if (lnum == top->lnum) |
3380 { | 3388 { |
3381 getvvcol(wp, top, (colnr_T *)&fromcol, NULL, NULL); | 3389 if (VIsual_mode == 'V') /* linewise */ |
3382 if (gchar_pos(top) == NUL) | 3390 fromcol = 0; |
3383 tocol = fromcol + 1; | |
3384 } | |
3385 } | |
3386 if (VIsual_mode != 'V' && lnum == bot->lnum) | |
3387 { | |
3388 if (*p_sel == 'e' && bot->col == 0 | |
3389 #ifdef FEAT_VIRTUALEDIT | |
3390 && bot->coladd == 0 | |
3391 #endif | |
3392 ) | |
3393 { | |
3394 fromcol = -10; | |
3395 tocol = MAXCOL; | |
3396 } | |
3397 else if (bot->col == MAXCOL) | |
3398 tocol = MAXCOL; | |
3399 else | |
3400 { | |
3401 pos = *bot; | |
3402 if (*p_sel == 'e') | |
3403 getvvcol(wp, &pos, (colnr_T *)&tocol, NULL, NULL); | |
3404 else | 3391 else |
3405 { | 3392 { |
3406 getvvcol(wp, &pos, NULL, NULL, (colnr_T *)&tocol); | 3393 getvvcol(wp, top, (colnr_T *)&fromcol, NULL, NULL); |
3407 ++tocol; | 3394 if (gchar_pos(top) == NUL) |
3395 tocol = fromcol + 1; | |
3408 } | 3396 } |
3409 } | 3397 } |
3410 } | 3398 if (VIsual_mode != 'V' && lnum == bot->lnum) |
3411 } | 3399 { |
3412 | 3400 if (*p_sel == 'e' && bot->col == 0 |
3413 /* Check if the character under the cursor should not be inverted */ | 3401 #ifdef FEAT_VIRTUALEDIT |
3414 if (!highlight_match && lnum == curwin->w_cursor.lnum && wp == curwin | 3402 && bot->coladd == 0 |
3403 #endif | |
3404 ) | |
3405 { | |
3406 fromcol = -10; | |
3407 tocol = MAXCOL; | |
3408 } | |
3409 else if (bot->col == MAXCOL) | |
3410 tocol = MAXCOL; | |
3411 else | |
3412 { | |
3413 pos = *bot; | |
3414 if (*p_sel == 'e') | |
3415 getvvcol(wp, &pos, (colnr_T *)&tocol, NULL, NULL); | |
3416 else | |
3417 { | |
3418 getvvcol(wp, &pos, NULL, NULL, (colnr_T *)&tocol); | |
3419 ++tocol; | |
3420 } | |
3421 } | |
3422 } | |
3423 } | |
3424 | |
3425 /* Check if the character under the cursor should not be inverted */ | |
3426 if (!highlight_match && lnum == curwin->w_cursor.lnum && wp == curwin | |
3415 #ifdef FEAT_GUI | 3427 #ifdef FEAT_GUI |
3416 && !gui.in_use | 3428 && !gui.in_use |
3417 #endif | 3429 #endif |
3418 ) | 3430 ) |
3419 noinvcur = TRUE; | 3431 noinvcur = TRUE; |
3420 | 3432 |
3421 /* if inverting in this line set area_highlighting */ | 3433 /* if inverting in this line set area_highlighting */ |
3422 if (fromcol >= 0) | 3434 if (fromcol >= 0) |
3423 { | 3435 { |
3436 area_highlighting = TRUE; | |
3437 attr = HL_ATTR(HLF_V); | |
3438 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) | |
3439 if ((clip_star.available && !clip_star.owned | |
3440 && clip_isautosel_star()) | |
3441 || (clip_plus.available && !clip_plus.owned | |
3442 && clip_isautosel_plus())) | |
3443 attr = HL_ATTR(HLF_VNC); | |
3444 #endif | |
3445 } | |
3446 } | |
3447 | |
3448 /* | |
3449 * handle 'incsearch' and ":s///c" highlighting | |
3450 */ | |
3451 else if (highlight_match | |
3452 && wp == curwin | |
3453 && lnum >= curwin->w_cursor.lnum | |
3454 && lnum <= curwin->w_cursor.lnum + search_match_lines) | |
3455 { | |
3456 if (lnum == curwin->w_cursor.lnum) | |
3457 getvcol(curwin, &(curwin->w_cursor), | |
3458 (colnr_T *)&fromcol, NULL, NULL); | |
3459 else | |
3460 fromcol = 0; | |
3461 if (lnum == curwin->w_cursor.lnum + search_match_lines) | |
3462 { | |
3463 pos.lnum = lnum; | |
3464 pos.col = search_match_endcol; | |
3465 getvcol(curwin, &pos, (colnr_T *)&tocol, NULL, NULL); | |
3466 } | |
3467 else | |
3468 tocol = MAXCOL; | |
3469 /* do at least one character; happens when past end of line */ | |
3470 if (fromcol == tocol) | |
3471 tocol = fromcol + 1; | |
3424 area_highlighting = TRUE; | 3472 area_highlighting = TRUE; |
3425 attr = HL_ATTR(HLF_V); | 3473 attr = HL_ATTR(HLF_I); |
3426 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) | 3474 } |
3427 if ((clip_star.available && !clip_star.owned | |
3428 && clip_isautosel_star()) | |
3429 || (clip_plus.available && !clip_plus.owned | |
3430 && clip_isautosel_plus())) | |
3431 attr = HL_ATTR(HLF_VNC); | |
3432 #endif | |
3433 } | |
3434 } | |
3435 | |
3436 /* | |
3437 * handle 'incsearch' and ":s///c" highlighting | |
3438 */ | |
3439 else if (highlight_match | |
3440 && wp == curwin | |
3441 && lnum >= curwin->w_cursor.lnum | |
3442 && lnum <= curwin->w_cursor.lnum + search_match_lines) | |
3443 { | |
3444 if (lnum == curwin->w_cursor.lnum) | |
3445 getvcol(curwin, &(curwin->w_cursor), | |
3446 (colnr_T *)&fromcol, NULL, NULL); | |
3447 else | |
3448 fromcol = 0; | |
3449 if (lnum == curwin->w_cursor.lnum + search_match_lines) | |
3450 { | |
3451 pos.lnum = lnum; | |
3452 pos.col = search_match_endcol; | |
3453 getvcol(curwin, &pos, (colnr_T *)&tocol, NULL, NULL); | |
3454 } | |
3455 else | |
3456 tocol = MAXCOL; | |
3457 /* do at least one character; happens when past end of line */ | |
3458 if (fromcol == tocol) | |
3459 tocol = fromcol + 1; | |
3460 area_highlighting = TRUE; | |
3461 attr = HL_ATTR(HLF_I); | |
3462 } | 3475 } |
3463 | 3476 |
3464 #ifdef FEAT_DIFF | 3477 #ifdef FEAT_DIFF |
3465 filler_lines = diff_check(wp, lnum); | 3478 filler_lines = diff_check(wp, lnum); |
3466 if (filler_lines < 0) | 3479 if (filler_lines < 0) |
3502 | 3515 |
3503 line = ml_get_buf(wp->w_buffer, lnum, FALSE); | 3516 line = ml_get_buf(wp->w_buffer, lnum, FALSE); |
3504 ptr = line; | 3517 ptr = line; |
3505 | 3518 |
3506 #ifdef FEAT_SPELL | 3519 #ifdef FEAT_SPELL |
3507 if (has_spell) | 3520 if (has_spell && !number_only) |
3508 { | 3521 { |
3509 /* For checking first word with a capital skip white space. */ | 3522 /* For checking first word with a capital skip white space. */ |
3510 if (cap_col == 0) | 3523 if (cap_col == 0) |
3511 cap_col = getwhitecols(line); | 3524 cap_col = getwhitecols(line); |
3512 | 3525 |
3562 */ | 3575 */ |
3563 if (wp->w_p_wrap) | 3576 if (wp->w_p_wrap) |
3564 v = wp->w_skipcol; | 3577 v = wp->w_skipcol; |
3565 else | 3578 else |
3566 v = wp->w_leftcol; | 3579 v = wp->w_leftcol; |
3567 if (v > 0) | 3580 if (v > 0 && !number_only) |
3568 { | 3581 { |
3569 #ifdef FEAT_MBYTE | 3582 #ifdef FEAT_MBYTE |
3570 char_u *prev_ptr = ptr; | 3583 char_u *prev_ptr = ptr; |
3571 #endif | 3584 #endif |
3572 while (vcol < v && *ptr != NUL) | 3585 while (vcol < v && *ptr != NUL) |
3705 * Handle highlighting the last used search pattern and matches. | 3718 * Handle highlighting the last used search pattern and matches. |
3706 * Do this for both search_hl and the match list. | 3719 * Do this for both search_hl and the match list. |
3707 */ | 3720 */ |
3708 cur = wp->w_match_head; | 3721 cur = wp->w_match_head; |
3709 shl_flag = FALSE; | 3722 shl_flag = FALSE; |
3710 while (cur != NULL || shl_flag == FALSE) | 3723 while ((cur != NULL || shl_flag == FALSE) && !number_only) |
3711 { | 3724 { |
3712 if (shl_flag == FALSE) | 3725 if (shl_flag == FALSE) |
3713 { | 3726 { |
3714 shl = &search_hl; | 3727 shl = &search_hl; |
3715 shl_flag = TRUE; | 3728 shl_flag = TRUE; |
4066 else | 4079 else |
4067 char_attr = 0; | 4080 char_attr = 0; |
4068 } | 4081 } |
4069 } | 4082 } |
4070 | 4083 |
4071 /* When still displaying '$' of change command, stop at cursor */ | 4084 // When still displaying '$' of change command, stop at cursor. |
4072 if (dollar_vcol >= 0 && wp == curwin | 4085 // When only displaying the (relative) line number and that's done, |
4086 // stop here. | |
4087 if ((dollar_vcol >= 0 && wp == curwin | |
4073 && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol | 4088 && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol |
4074 #ifdef FEAT_DIFF | 4089 #ifdef FEAT_DIFF |
4075 && filler_todo <= 0 | 4090 && filler_todo <= 0 |
4076 #endif | 4091 #endif |
4077 ) | 4092 ) |
4093 || (number_only && draw_state > WL_NR)) | |
4078 { | 4094 { |
4079 screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width, | 4095 screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width, |
4080 HAS_RIGHTLEFT(wp->w_p_rl)); | 4096 HAS_RIGHTLEFT(wp->w_p_rl)); |
4081 /* Pretend we have finished updating the window. Except when | 4097 /* Pretend we have finished updating the window. Except when |
4082 * 'cursorcolumn' is set. */ | 4098 * 'cursorcolumn' is set. */ |