aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/drawline.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-06 20:18:23 +0800
committerGitHub <noreply@github.com>2024-02-06 20:18:23 +0800
commit7fa84f32e7cf915a8ec6a9da90efe09f195b4b69 (patch)
tree73df3cd971f994e9fc0389937e15a368e32b1b37 /src/nvim/drawline.c
parent63b810c9d8543bfcbee0367554e97cb97d1c14e6 (diff)
downloadrneovim-7fa84f32e7cf915a8ec6a9da90efe09f195b4b69.tar.gz
rneovim-7fa84f32e7cf915a8ec6a9da90efe09f195b4b69.tar.bz2
rneovim-7fa84f32e7cf915a8ec6a9da90efe09f195b4b69.zip
vim-patch:9.1.0079: LineNrAbove/Below highlighting wrong on wrapped lines (#27363)
Problem: LineNrAbove and LineNrBelow background wrong on wrapped lines. Solution: Update number column also for wrapped part of a line. (zeertzjq) closes: vim/vim#13974 https://github.com/vim/vim/commit/ebfd856cfdf6ea0b16c8d115000961c998ce97da Cherry-pick test_number.vim changes from patch 9.0.0626.
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r--src/nvim/drawline.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index b5c0755d44..174543242f 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -929,7 +929,8 @@ static int get_rightmost_vcol(win_T *wp, const int *color_cols)
/// @param lnum line to display
/// @param startrow first row relative to window grid
/// @param endrow last grid row to be redrawn
-/// @param col_rows only update the columns for this amount of rows
+/// @param col_rows set to the height of the line when only updating the columns,
+/// otherwise set to 0
/// @param spv 'spell' related variables kept between calls for "wp"
/// @param foldinfo fold info for this line
/// @param[in, out] providers decoration providers active this line
@@ -1556,6 +1557,36 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
win_col_offset = wlv.off;
+ // When only updating the columns and that's done, stop here.
+ if (col_rows > 0) {
+ win_put_linebuf(wp, wlv.row, 0, wlv.off, wlv.off, bg_attr, false);
+ // Need to update more screen lines if:
+ // - 'statuscolumn' needs to be drawn, or
+ // - LineNrAbove or LineNrBelow is used, or
+ // - still drawing filler lines.
+ if ((wlv.row + 1 - wlv.startrow < col_rows
+ && (statuscol.draw
+ || win_hl_attr(wp, HLF_LNA) != win_hl_attr(wp, HLF_N)
+ || win_hl_attr(wp, HLF_LNB) != win_hl_attr(wp, HLF_N)))
+ || wlv.filler_todo > 0) {
+ wlv.row++;
+ if (wlv.row == endrow) {
+ break;
+ }
+ wlv.filler_todo--;
+ if (wlv.filler_todo == 0 && (wp->w_botfill || end_fill)) {
+ break;
+ }
+ // win_line_start(wp, &wlv);
+ wlv.col = 0;
+ wlv.off = 0;
+ draw_cols = true;
+ continue;
+ } else {
+ break;
+ }
+ }
+
// Check if 'breakindent' applies and show it.
if (!wp->w_briopt_sbr) {
handle_breakindent(wp, &wlv);
@@ -1580,24 +1611,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
apply_cursorline_highlight(wp, &wlv);
}
- // When still displaying '$' of change command, stop at cursor
- if (((dollar_vcol >= 0
- && wp == curwin
- && lnum == wp->w_cursor.lnum
- && wlv.vcol >= wp->w_virtcol)
- || col_rows > 0)
- && wlv.filler_todo <= 0) {
- if (col_rows == 0) {
- draw_virt_text(wp, buf, win_col_offset, &wlv.col, wlv.row);
- }
+ // When still displaying '$' of change command, stop at cursor.
+ if (dollar_vcol >= 0 && wp == curwin
+ && lnum == wp->w_cursor.lnum && wlv.vcol >= wp->w_virtcol) {
+ draw_virt_text(wp, buf, win_col_offset, &wlv.col, wlv.row);
// don't clear anything after wlv.col
win_put_linebuf(wp, wlv.row, 0, wlv.col, wlv.col, bg_attr, false);
- // update the 'statuscolumn' for the entire line size
- if (col_rows > 0 && statuscol.draw && ++wlv.row - wlv.startrow < col_rows) {
- draw_cols = true;
- wlv.off = 0;
- continue;
- }
// Pretend we have finished updating the window. Except when
// 'cursorcolumn' is set.
if (wp->w_p_cuc) {