diff --git a/src/nvim/window.c b/src/nvim/window.c index 08889451ab..07e769b7ac 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2869,7 +2869,8 @@ int win_close(win_T *win, bool free_buf, bool force) if (wp == curwin) { break; } - if (!wp->w_p_pvw && !bt_quickfix(wp->w_buffer)) { + if (!wp->w_p_pvw && !bt_quickfix(wp->w_buffer) + && !(wp->w_floating && !wp->w_config.focusable)) { curwin = wp; break; } diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index ed66557ee8..d3a20ca021 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -434,6 +434,25 @@ describe('float window', function() eq(winid, eval('win_getid()')) end) + it('is not active after closing window when non-focusable #28454', function() + command('copen') + local winid = exec_lua([[ + local bufnr = vim.api.nvim_create_buf(false, true) + local opts = { + relative = 'editor', + focusable = false, + height = 5, + width = 5, + col = 5, + row = 5, + } + return vim.api.nvim_open_win(bufnr, false, opts) + ]]) + command('wincmd t') + command('wincmd q') + neq(winid, curwin()) + end) + it('supports windo with focusable and non-focusable floats', function() local winids = exec_lua([[ local result = {vim.api.nvim_get_current_win()}