aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2019-04-11 20:20:17 +0200
committerGitHub <noreply@github.com>2019-04-11 20:20:17 +0200
commitae88e4656305f1f760b4aa2a0f29bfc11d6d80b6 (patch)
treee1ea7deebeae5849c72a13a5d418259f523d2270 /src
parentb358054694765b595ff3ef64a5b0bba98628c218 (diff)
downloadrneovim-ae88e4656305f1f760b4aa2a0f29bfc11d6d80b6.tar.gz
rneovim-ae88e4656305f1f760b4aa2a0f29bfc11d6d80b6.tar.bz2
rneovim-ae88e4656305f1f760b4aa2a0f29bfc11d6d80b6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/window.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 237338f974..9555c88138 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -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--) {