0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.0751: 'scrolloff' does not work well with 'smoothscroll'

Problem:    'scrolloff' does not work well with 'smoothscroll'.
Solution:   Make positioning the cursor a bit better.  Rename functions.
This commit is contained in:
Bram Moolenaar
2022-10-14 20:09:04 +01:00
parent 0abd6cf62d
commit c9121f798f
10 changed files with 62 additions and 23 deletions

View File

@@ -743,13 +743,13 @@ win_chartabsize(win_T *wp, char_u *p, colnr_T col)
* Does not handle text properties, since "s" is not a buffer line.
*/
int
linetabsize(char_u *s)
linetabsize_str(char_u *s)
{
return linetabsize_col(0, s);
}
/*
* Like linetabsize(), but "s" starts at column "startcol".
* Like linetabsize_str(), but "s" starts at column "startcol".
*/
int
linetabsize_col(int startcol, char_u *s)
@@ -772,7 +772,7 @@ linetabsize_col(int startcol, char_u *s)
}
/*
* Like linetabsize(), but for a given window instead of the current one.
* Like linetabsize_str(), but for a given window instead of the current one.
*/
int
win_linetabsize(win_T *wp, linenr_T lnum, char_u *line, colnr_T len)
@@ -785,6 +785,17 @@ win_linetabsize(win_T *wp, linenr_T lnum, char_u *line, colnr_T len)
return (int)cts.cts_vcol;
}
/*
* 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.
*/
int
linetabsize(win_T *wp, linenr_T lnum)
{
return win_linetabsize(wp, lnum,
ml_get_buf(wp->w_buffer, lnum, FALSE), (colnr_T)MAXCOL);
}
void
win_linetabsize_cts(chartabsize_T *cts, colnr_T len)
{