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)
98da6ecab9
This commit is contained in:
Jan Edmund Lazo 2018-08-21 12:33:00 -04:00
parent 39777ad4b8
commit b5fc21dbf0

View File

@ -565,6 +565,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
int before; int before;
int minheight; int minheight;
int wmh1; int wmh1;
bool did_set_fraction = false;
if (flags & WSP_TOP) if (flags & WSP_TOP)
oldwin = firstwin; 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 * 'winfixheight' window. Take them from a window above or below
* instead, if possible. */ * instead, if possible. */
if (oldwin->w_p_wfh) { 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, win_setheight_win(oldwin->w_height + new_size + STATUS_HEIGHT,
oldwin); oldwin);
oldwin_height = oldwin->w_height; 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 /* Set w_fraction now so that the cursor keeps the same relative
* vertical position. */ * vertical position. */
if (!did_set_fraction) {
set_fraction(oldwin); set_fraction(oldwin);
}
wp->w_fraction = oldwin->w_fraction; wp->w_fraction = oldwin->w_fraction;
if (flags & WSP_VERT) { if (flags & WSP_VERT) {