Mercurial > vim
comparison src/drawscreen.c @ 34296:0690fd6f9d48 v9.1.0083
patch 9.1.0083: Redrawing can be improved when deleting lines with 'number'
Commit: https://github.com/vim/vim/commit/ae07ebc04b0726e12b1af39d52e01d86ae79ef0a
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu Feb 8 11:37:40 2024 +0100
patch 9.1.0083: Redrawing can be improved when deleting lines with 'number'
Problem: Redrawing can be improved when inserting/deleting lines with 'number'.
Solution: Only redraw the number column of lines below changed lines.
Add a test as this wasn't previously tested.
(zeertzjq)
closes: #13985
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 08 Feb 2024 11:45:04 +0100 |
parents | 7afcc5481eb7 |
children | ef421bb0f67e |
comparison
equal
deleted
inserted
replaced
34295:c76488d85d08 | 34296:0690fd6f9d48 |
---|---|
1697 #ifdef FEAT_SYN_HL | 1697 #ifdef FEAT_SYN_HL |
1698 else if (syntax_present(wp)) | 1698 else if (syntax_present(wp)) |
1699 top_end = 1; | 1699 top_end = 1; |
1700 #endif | 1700 #endif |
1701 } | 1701 } |
1702 | |
1703 // When line numbers are displayed need to redraw all lines below | |
1704 // inserted/deleted lines. | |
1705 if (mod_top != 0 && buf->b_mod_xlines != 0 && wp->w_p_nu) | |
1706 mod_bot = MAXLNUM; | |
1707 } | 1702 } |
1708 wp->w_redraw_top = 0; // reset for next time | 1703 wp->w_redraw_top = 0; // reset for next time |
1709 wp->w_redraw_bot = 0; | 1704 wp->w_redraw_bot = 0; |
1710 #ifdef FEAT_SEARCH_EXTRA | 1705 #ifdef FEAT_SEARCH_EXTRA |
1711 search_hl_has_cursor_lnum = 0; | 1706 search_hl_has_cursor_lnum = 0; |
2538 ++lnum; | 2533 ++lnum; |
2539 #endif | 2534 #endif |
2540 } | 2535 } |
2541 else | 2536 else |
2542 { | 2537 { |
2543 if (wp->w_p_rnu && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum) | 2538 // If: |
2539 // - 'number' is set and below inserted/deleted lines, or | |
2540 // - 'relativenumber' is set and cursor moved vertically, | |
2541 // the text doesn't need to be redrawn, but the number column does. | |
2542 if ((wp->w_p_nu && mod_top != 0 | |
2543 && lnum >= mod_bot && buf->b_mod_xlines != 0) | |
2544 || (wp->w_p_rnu | |
2545 && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum)) | |
2544 { | 2546 { |
2545 #ifdef FEAT_FOLDING | 2547 #ifdef FEAT_FOLDING |
2546 // 'relativenumber' set and the cursor moved vertically: The | |
2547 // text doesn't need to be drawn, but the number column does. | |
2548 fold_count = foldedCount(wp, lnum, &win_foldinfo); | 2548 fold_count = foldedCount(wp, lnum, &win_foldinfo); |
2549 if (fold_count != 0) | 2549 if (fold_count != 0) |
2550 fold_line(wp, fold_count, &win_foldinfo, lnum, row); | 2550 fold_line(wp, fold_count, &win_foldinfo, lnum, row); |
2551 else | 2551 else |
2552 #endif | 2552 #endif |