diff src/charset.c @ 30833:e3d5781c7ec6 v9.0.0751

patch 9.0.0751: 'scrolloff' does not work well with 'smoothscroll' Commit: https://github.com/vim/vim/commit/c9121f798f49fa71e814912cb186d89c164090c3 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 14 20:09:04 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Fri, 14 Oct 2022 21:15:03 +0200
parents c7983f593fa7
children 360f286b5869
line wrap: on
line diff
--- a/src/charset.c
+++ b/src/charset.c
@@ -743,13 +743,13 @@ win_chartabsize(win_T *wp, char_u *p, co
  * 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
     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)
 {