float: always change to valid windows (#9878)

Using `:wincmd j` and friends doesn't make much sense to a floating window. For
convenience though, any direction will simply change to the previous window.

Make sure the previous window is valid, not the current window, and not another
floating window. Change to the first window (which is never a floating window)
otherwise.
This commit is contained in:
Marco Hinz
2019-04-11 20:20:17 +02:00
committed by GitHub
parent b358054694
commit ae88e46563
2 changed files with 16 additions and 2 deletions

View File

@@ -4037,7 +4037,7 @@ win_T *win_vert_neighbor(tabpage_T *tp, win_T *wp, bool up, long count)
foundfr = wp->w_frame;
if (wp->w_floating) {
return prevwin;
return win_valid(prevwin) && !prevwin->w_floating ? prevwin : firstwin;
}
while (count--) {
@@ -4118,7 +4118,7 @@ win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, bool left, long count)
foundfr = wp->w_frame;
if (wp->w_floating) {
return prevwin;
return win_valid(prevwin) && !prevwin->w_floating ? prevwin : firstwin;
}
while (count--) {