]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.1707: when 'wfh' is set ":bel 10new" scrolls window v8.0.1707
authorBram Moolenaar <Bram@vim.org>
Fri, 13 Apr 2018 20:15:46 +0000 (22:15 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 13 Apr 2018 20:15:46 +0000 (22:15 +0200)
Problem:    When 'wfh' is set ":bel 10new" scrolls window. (Andrew Pyatkov)
Solution:   Set the fraction before changing the window height. (closes #2798)

src/version.c
src/window.c

index 4cba81849481a23d1fb409123eb32964599e1c4b..5facbc58114e1ec5025ae95fa4f55c42e38ddda4 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1707,
 /**/
     1706,
 /**/
index a1b2a45cc08a73754412755d6c55072d20a05a41..333663ba36b1e8bac0ef570951f143186ab5af28 100644 (file)
@@ -778,6 +778,7 @@ win_split_ins(
     int                before;
     int                minheight;
     int                wmh1;
+    int                did_set_fraction = FALSE;
 
     if (flags & WSP_TOP)
        oldwin = firstwin;
@@ -959,6 +960,11 @@ win_split_ins(
         * instead, if possible. */
        if (oldwin->w_p_wfh)
        {
+           /* Set w_fraction now so that the cursor keeps the same relative
+            * vertical position using the old height. */
+           set_fraction(oldwin);
+           did_set_fraction = TRUE;
+
            win_setheight_win(oldwin->w_height + new_size + STATUS_HEIGHT,
                                                                      oldwin);
            oldwin_height = oldwin->w_height;
@@ -1088,7 +1094,8 @@ win_split_ins(
 
     /* Set w_fraction now so that the cursor keeps the same relative
      * vertical position. */
-    set_fraction(oldwin);
+    if (!did_set_fraction)
+       set_fraction(oldwin);
     wp->w_fraction = oldwin->w_fraction;
 
     if (flags & WSP_VERT)