]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1883: Wrong display with 'smoothscroll' with -diff v9.1.1883
authorzeertzjq <zeertzjq@outlook.com>
Tue, 28 Oct 2025 19:03:22 +0000 (19:03 +0000)
committerChristian Brabandt <cb@256bit.org>
Tue, 28 Oct 2025 19:03:22 +0000 (19:03 +0000)
Problem:  Wrong display with 'smoothscroll' when FEAT_DIFF is disabled.
Solution: Use plines_correct_topline() (zeertzjq).

closes: #18649

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/drawscreen.c
src/move.c
src/proto/move.pro
src/testdir/test_scroll_opt.vim
src/version.c

index 0519940b1518621a211310cdd07f2810871f2ab1..3cd2514d501a0f7f157a4bc0bfeadcdca049f5bf 100644 (file)
@@ -1919,13 +1919,8 @@ win_update(win_T *wp)
                    // Correct the first entry for filler lines at the top
                    // when it won't get updated below.
                    if (wp->w_p_diff && bot_start > 0)
-                   {
-                       int n = plines_win_nofill(wp, wp->w_topline, FALSE)
-                             + wp->w_topfill - adjust_plines_for_skipcol(wp);
-                       if (n > wp->w_height)
-                           n = wp->w_height;
-                       wp->w_lines[0].wl_size = n;
-                   }
+                       wp->w_lines[0].wl_size = plines_correct_topline(wp,
+                                                         wp->w_topline, TRUE);
 #endif
                }
            }
@@ -2342,21 +2337,7 @@ win_update(win_T *wp)
                            ++new_rows;
                        else
 #endif
-                       {
-#ifdef FEAT_DIFF
-                           if (l == wp->w_topline)
-                           {
-                               int n = plines_win_nofill(wp, l, FALSE)
-                                                               + wp->w_topfill;
-                               n -= adjust_plines_for_skipcol(wp);
-                               if (n > wp->w_height)
-                                   n = wp->w_height;
-                               new_rows += n;
-                           }
-                           else
-#endif
-                               new_rows += plines_win(wp, l, TRUE);
-                       }
+                           new_rows += plines_correct_topline(wp, l, TRUE);
                        ++j;
                        if (new_rows > wp->w_height - row - 2)
                        {
index 784103070a46d6d1916c145e4bed48eecab84600..6f25c5d66b389178ab9c2c76db51b814fab7ba8d 100644 (file)
@@ -39,7 +39,7 @@ static void botline_forw(lineoff_T *lp);
 /*
  * Get the number of screen lines skipped with "wp->w_skipcol".
  */
-    int
+    static int
 adjust_plines_for_skipcol(win_T *wp)
 {
     if (wp->w_skipcol == 0)
@@ -58,7 +58,7 @@ adjust_plines_for_skipcol(win_T *wp)
  * whether it is the first line, whether w_skipcol is non-zero and limiting to
  * the window height.
  */
-    static int
+    int
 plines_correct_topline(win_T *wp, linenr_T lnum, int limit_winheight)
 {
     int n;
index 4760ebc797c0a856ce77cf5bd4d0d1a082c228cc..489e85010886133abda6edf9f9e7c946f0f9d738 100644 (file)
@@ -1,5 +1,5 @@
 /* move.c */
-int adjust_plines_for_skipcol(win_T *wp);
+int plines_correct_topline(win_T *wp, linenr_T lnum, int limit_winheight);
 void set_valid_virtcol(win_T *wp, colnr_T vcol);
 int sms_marker_overlap(win_T *wp, int extra2);
 void update_topline_redraw(void);
index 27f269a3770ae474bc7b0ea953a7c8ef32328f57..0d9d3d984531186640b3d2f836f2a05bfc0d3b29 100644 (file)
@@ -277,6 +277,7 @@ endfunc
 
 func Test_smoothscroll_diff_mode()
   CheckScreendump
+  CheckFeature diff
 
   let lines =<< trim END
       vim9script
@@ -303,6 +304,7 @@ endfunc
 
 func Test_smoothscroll_diff_change_line_default()
   CheckScreendump
+  CheckFeature diff
 
   " Uses the new diffopt default with indent-heuristic and inline:char
   let lines =<< trim END
@@ -334,6 +336,7 @@ endfunc
 
 func Test_smoothscroll_diff_change_line()
   CheckScreendump
+  CheckFeature diff
 
   " Uses the old diffopt default
   let lines =<< trim END
index ed9059da4ad445dc392982abcfe0ebe51068edbe..c34ae073497e1a68b45cae30a98dea781fca86e6 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1883,
 /**/
     1882,
 /**/