summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-13 22:15:46 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-13 22:15:46 +0200
commit98da6ecab905df48a67da36ce60233f45726c979 (patch)
treef6c377a44a041db152c2dfce49c58b49f720df61
parentb59118d5012a6a07e2d54504fbb04837b5a1208c (diff)
patch 8.0.1707: when 'wfh' is set ":bel 10new" scrolls windowv8.0.1707
Problem: When 'wfh' is set ":bel 10new" scrolls window. (Andrew Pyatkov) Solution: Set the fraction before changing the window height. (closes #2798)
-rw-r--r--src/version.c2
-rw-r--r--src/window.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/version.c b/src/version.c
index 4cba818494..5facbc5811 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1707,
+/**/
1706,
/**/
1705,
diff --git a/src/window.c b/src/window.c
index a1b2a45cc0..333663ba36 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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)