-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Set winbar throws not enough space error even when there's space. #19464
Comments
about not having space in floating windows. This implements a temporary workaround the issue(neovim/neovim#19464) until the bug in neovim gets fixed.
* feat: refresh lualine based on timer. * fix config test * fix lag on win change issue * handle errors in timer callback * feat: add winbar support Pull in winbar changes form pr #689 and adapt them Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> * make winbar disapear when winbar evals empty * only update stl of curwin with globalstatus * properly clear win local stl and wbr opts * add version guards for winbar feature * only add winbar if height > 1 * fix tests? * refresh lualine on ModeChanged event * ignore floating windows for refresh * properply restore options to previous state * fix stl not updating in cmd mode + some optimizations * fix tests on <nvim-0.7 * merge status_dispatch & winbar_dispatch + winbar support for extensions * fix globalstatus option not live updating * update docs * feat: allow disabling winbar and statusline separately * fix tests * fix: winbar some times oddly throwing errors about not having space in floating windows. This implements a temporary workaround the issue(neovim/neovim#19464) until the bug in neovim gets fixed. Co-authored-by: Diego Fujii <android.mxdiego9@gmail.com>
There isn't enough room on the floating window since it's only a single row and the only row cannot be a winbar, and winbar will not resize float windows by its own volition |
When a floating window is created its |
You're missing the point . The floating window isn't suppose to have a winbar . The winbar option is set as window local option on a different window. |
It seems like this is still intended behavior since floating windows are supposed to act like split windows but just floating, so it's desired for them to inherit all options from the last window. |
In that case why doesn't winbar get set if the autocommand isn't there ? -- file: minimal_reproduce.lua
local win = vim.api.nvim_get_current_win()
vim.wo[win].winbar = '%f'
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_open_win(buf, true, {
relative = "win",
win = win,
border = 'single',
col = 1,
row = 1,
height = 1,
width = 40,
}) This should throw error too right ? Note floats with height 1 is a lot more common then splits with height 1. It's not very likely you'll hit not enough space error with splits but you'll regularly hit it with floats as a ton of plugins use single height floats (I think lsp & diagnostic code in core does too). And if it's the default behavior then it's impossible handle this error as Winbar in floats are already an exception as in they don't render globar winbar option (BTW why was this decision made ?) I think it's better if floats don't inherit winbar option. |
some of them are caused by neovim/neovim#15300 some are neovim/neovim#19464 and other unknown bugs too So as workaround don't update statusline in autocmd context immediately instead defer the refresh to 50ms later in timer context. fixes #751 #753 #755
A workaround is to switch to the floating window later, after it's buffer is set, by passing -- file: minimal_reproduce.lua
local win = vim.api.nvim_get_current_win()
vim.wo[win].winbar = '%f'
local grp = vim.api.nvim_create_augroup('asdf', {clear=true})
vim.api.nvim_create_autocmd('WinEnter', {
group = grp,
pattern = '*',
desc = 'winbar crash?',
callback = function ()
vim.wo[win].winbar = '%f'
end
})
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_set_current_win(vim.api.nvim_open_win(buf, false, {
relative = "win",
win = win,
border = 'single',
col = 1,
row = 1,
height = 1,
width = 40,
})) This workaround works for |
…ot enough room" errors This is a temporary hacky fix that should be removed with neovim/neovim#19464
Due to the neovim upstream issue (neovim/neovim#19464), creating a float window will always inherit the winbar from the parent window. As such, the window height need to be >=2 to prevent "E36: Not enough room" error.
Due to the neovim upstream issue (neovim/neovim#19464), creating a float window will always inherit the winbar from the parent window. As such, the window height need to be >=2 to prevent "E36: Not enough room" error.
) * feat: refresh lualine based on timer. * fix config test * fix lag on win change issue * handle errors in timer callback * feat: add winbar support Pull in winbar changes form pr nvim-lualine#689 and adapt them Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> * make winbar disapear when winbar evals empty * only update stl of curwin with globalstatus * properly clear win local stl and wbr opts * add version guards for winbar feature * only add winbar if height > 1 * fix tests? * refresh lualine on ModeChanged event * ignore floating windows for refresh * properply restore options to previous state * fix stl not updating in cmd mode + some optimizations * fix tests on <nvim-0.7 * merge status_dispatch & winbar_dispatch + winbar support for extensions * fix globalstatus option not live updating * update docs * feat: allow disabling winbar and statusline separately * fix tests * fix: winbar some times oddly throwing errors about not having space in floating windows. This implements a temporary workaround the issue(neovim/neovim#19464) until the bug in neovim gets fixed. Co-authored-by: Diego Fujii <android.mxdiego9@gmail.com>
some of them are caused by neovim/neovim#15300 some are neovim/neovim#19464 and other unknown bugs too So as workaround don't update statusline in autocmd context immediately instead defer the refresh to 50ms later in timer context. fixes nvim-lualine#751 nvim-lualine#753 nvim-lualine#755
Neovim version (nvim -v)
0.8.0 commit 1f1863e
Vim (not Nvim) behaves the same?
no
Operating system/version
Arch linux
Terminal name/version
Kitty terminal
$TERM environment variable
screen-256color
Installation
build from repo
How to reproduce the issue
Reproduction steps
nvim --clean minimal_reproduce.lua :lua require('minimal_reproduce')
Things to note
Expected behavior
No error should be thrown as the original window has enough space in it to draw winbar.
Actual behavior
It throws following error
Speculations
It seems nvim is trying to draw winbar on the float even though winbar option in that window is empty . This can actually be seen if you open the float with height 2 the float buffer starts after an empty line.
@famiu any clue ?
The text was updated successfully, but these errors were encountered: