aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-21 12:33:00 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-21 12:44:06 -0400
commitb5fc21dbf05874ef7901a5e66f39612c46a698e3 (patch)
tree722e8262734c85ebe01641994967be6cd6d414c9
parent39777ad4b8fdd4e09df85025667845b43e1f2d72 (diff)
downloadrneovim-b5fc21dbf05874ef7901a5e66f39612c46a698e3.tar.gz
rneovim-b5fc21dbf05874ef7901a5e66f39612c46a698e3.tar.bz2
rneovim-b5fc21dbf05874ef7901a5e66f39612c46a698e3.zip
vim-patch:8.0.1707: when 'wfh' is set ":bel 10new" scrolls window
Problem: When 'wfh' is set ":bel 10new" scrolls window. (Andrew Pyatkov) Solution: Set the fraction before changing the window height. (closes vim/vim#2798) https://github.com/vim/vim/commit/98da6ecab905df48a67da36ce60233f45726c979
-rw-r--r--src/nvim/window.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index d9903338e8..89ab2c2b9c 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -565,6 +565,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
int before;
int minheight;
int wmh1;
+ bool did_set_fraction = false;
if (flags & WSP_TOP)
oldwin = firstwin;
@@ -729,6 +730,11 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
* 'winfixheight' window. Take them from a window above or below
* 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;
@@ -843,7 +849,9 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
/* 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) {