mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 01:21:48 +00:00
fix(window): skip unfocusable and hidden floats with "{count}<C-W>w" #33810
Problem: Using `<C-W>w`, `<C-W>W` or the ":wincmd" variants with a count can enter unfocusable or hidden floating windows. This is especially problematic when using the new in-development extui, which creates many unfocusable floats for various UI elements. Solution: Skip unfocusable and hidden floating windows. Instead, skip to the next focusable, non-hidden window in the current tabpage's window list. Reword the documentation a bit (hopefully an improvement?)
This commit is contained in:
@@ -348,12 +348,23 @@ newwindow:
|
||||
} else {
|
||||
win_T *wp;
|
||||
if (Prenum) { // go to specified window
|
||||
win_T *last_focusable = firstwin;
|
||||
for (wp = firstwin; --Prenum > 0;) {
|
||||
if (!wp->w_floating || (!wp->w_config.hide && wp->w_config.focusable)) {
|
||||
last_focusable = wp;
|
||||
}
|
||||
if (wp->w_next == NULL) {
|
||||
break;
|
||||
}
|
||||
wp = wp->w_next;
|
||||
}
|
||||
while (wp != NULL && wp->w_floating
|
||||
&& (wp->w_config.hide || !wp->w_config.focusable)) {
|
||||
wp = wp->w_next;
|
||||
}
|
||||
if (wp == NULL) { // went past the last focusable window
|
||||
wp = last_focusable;
|
||||
}
|
||||
} else {
|
||||
if (nchar == 'W') { // go to previous window
|
||||
wp = curwin->w_prev;
|
||||
|
||||
Reference in New Issue
Block a user