vim-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.

c9121f798f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
Luuk van Baal
2023-04-27 00:03:46 +02:00
parent 223c7173ee
commit c426f7a622
7 changed files with 52 additions and 25 deletions

View File

@@ -243,12 +243,12 @@ int win_chartabsize(win_T *wp, char *p, colnr_T col)
/// @param s
///
/// @return Number of characters the string will take on the screen.
int linetabsize(char *s)
int linetabsize_str(char *s)
{
return linetabsize_col(0, s);
}
/// Like linetabsize(), but "s" starts at column "startcol".
/// Like linetabsize_str(), but "s" starts at column "startcol".
///
/// @param startcol
/// @param s
@@ -265,7 +265,7 @@ int linetabsize_col(int startcol, char *s)
return cts.cts_vcol;
}
/// 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.
///
/// @param wp
/// @param line
@@ -284,6 +284,13 @@ unsigned win_linetabsize(win_T *wp, linenr_T lnum, char *line, colnr_T len)
return (unsigned)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.
unsigned linetabsize(win_T *wp, linenr_T lnum)
{
return win_linetabsize(wp, lnum, ml_get_buf(wp->w_buffer, lnum, false), (colnr_T)MAXCOL);
}
/// Prepare the structure passed to chartabsize functions.
///
/// "line" is the start of the line, "ptr" is the first relevant character.