Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"focusable" for non-floating (split) windows #29365

Open
cortesi opened this issue Jun 15, 2024 · 0 comments
Open

"focusable" for non-floating (split) windows #29365

cortesi opened this issue Jun 15, 2024 · 0 comments
Labels
enhancement feature request float floating windows
Milestone

Comments

@cortesi
Copy link

cortesi commented Jun 15, 2024

Problem

The "focusable" attribute is explicitly ignored for non-floating windows. For example, here is the code for going to the next/previous window, which ignores focusable==false unless the window is also floating:

neovim/src/nvim/window.c

Lines 355 to 374 in 7e65f37

if (nchar == 'W') { // go to previous window
wp = curwin->w_prev;
if (wp == NULL) {
wp = lastwin; // wrap around
}
while (wp != NULL && wp->w_floating
&& !wp->w_config.focusable) {
wp = wp->w_prev;
}
} else { // go to next window
wp = curwin->w_next;
while (wp != NULL && wp->w_floating
&& !wp->w_config.focusable) {
wp = wp->w_next;
}
if (wp == NULL) {
wp = firstwin; // wrap around
}
}
}

I'm working on an addon that adds "companion windows" for certain functionality where non-focusable, non-floating windows would be really useful. I note that it's possible to set the focusable flag on non-floating windows without error, and the fact that focusable only applies to floating windows is not mentioned in the docs.

  • I'd be happy create a PR to change window navigation to respect the focusable flag unambiguously. Can anyone who knows the project well think of a reason why this shouldn't be done?
  • If we can't fix the behaviour, I think we should at least fix the docs to be explicit about this. We should also consider returning an error when the focusable flag is set on a non-floating window, as we currently do for other attributes that are floating-only (borders for example). I'd be happy to create a PR for this too.

Expected behavior

When the focusable flag is false for a non-floating window, I expect window navigation commands to skip the window.

@cortesi cortesi added the enhancement feature request label Jun 15, 2024
@glepnir glepnir added the float floating windows label Jun 16, 2024
@justinmk justinmk added this to the unplanned milestone Jun 17, 2024
@justinmk justinmk added the needs:vim-patch upstream issue that must be fixed in Vim first label Jun 17, 2024
@justinmk justinmk changed the title "focusble" is ignored for non-floating windows "focusable" is ignored for non-floating (split) windows Jun 17, 2024
@justinmk justinmk changed the title "focusable" is ignored for non-floating (split) windows "focusable" for non-floating (split) windows Jun 17, 2024
@glepnir glepnir removed the needs:vim-patch upstream issue that must be fixed in Vim first label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request float floating windows
Projects
None yet
Development

No branches or pull requests

3 participants