1
0
forked from aniani/vim

patch 9.1.1108: 'smoothscroll' gets stuck with 'listchars' "eol"

Problem:  'smoothscroll' gets stuck with 'listchars' "eol".
Solution: Count size of 'listchars' "eol" in line size when scrolling.
          (zeertzjq)

related: neovim/neovim#32405
closes: #16627

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-02-13 20:34:34 +01:00
committed by Christian Brabandt
parent c0b7ca406b
commit 2c47ab8fcd
8 changed files with 102 additions and 20 deletions

View File

@@ -821,6 +821,7 @@ linetabsize_col(int startcol, char_u *s)
/*
* Like linetabsize_str(), but for a given window instead of the current one.
* Doesn't count the size of 'listchars' "eol".
*/
int
win_linetabsize(win_T *wp, linenr_T lnum, char_u *line, colnr_T len)
@@ -836,14 +837,25 @@ win_linetabsize(win_T *wp, linenr_T lnum, char_u *line, colnr_T len)
/*
* Return the number of cells line "lnum" of window "wp" will take on the
* screen, taking into account the size of a tab and text properties.
* Doesn't count the size of 'listchars' "eol".
*/
int
int
linetabsize(win_T *wp, linenr_T lnum)
{
return win_linetabsize(wp, lnum,
ml_get_buf(wp->w_buffer, lnum, FALSE), (colnr_T)MAXCOL);
}
/*
* Like linetabsize(), but counts the size of 'listchars' "eol".
*/
int
linetabsize_eol(win_T *wp, linenr_T lnum)
{
return linetabsize(wp, lnum)
+ ((wp->w_p_list && wp->w_lcs_chars.eol != NUL) ? 1 : 0);
}
/*
* Like linetabsize(), but excludes 'above'/'after'/'right'/'below' aligned
* virtual text, while keeping inline virtual text.