Closed ecosse3 closed 2 years ago
Without a repro this will be difficult to address. I just pushed up a commit that exposes more of the underlying config options for nui, and additionally sets the filetype by default to be DressingSelect
(previously it was empty, which you can verify with :set filetype?
). Hopefully that should be enough to get your filetype exclusion working.
Some other exclusions you may want to use are
-- Inside a floating window
vim.api.nvim_win_get_config(0).relative ~= ""
-- Inside an unnamed buffer
vim.api.nvim_buf_get_name(0) == ""
-- Inside a non-normal buffer (e.g. quickfix, terminal, etc)
vim.api.nvim_buf_get_option(0, 'buftype') ~= ""
Unfortunately now I have different issue with Select (code actions) and it breaks even without winbar
implementation.
vim.ui.input
with nui works fine without winbar. Still same issue when using winbar.
I've checked and vim.bo.filetype
is "DressingSelect" as expected now, but still breaks.
My config can be installed via https://github.com/ecosse3/nvim but unfortunately I'm not able to setup Docker (Alpine Linux) with Neovim Nightly for testing (just 0.7 is available).
Apologies, there was a small bug with my last commit. The crash should not happen anymore, and you should be able to test if the winbar logic works now.
@stevearc Thanks. Now NUI select works with code actions. Unfortunately, it has more height than expected:
With vim.ui.input
I'm still experiencing the same issue. Error, and then after
You can adjust the height by changing the min_height
value in the nui config area.
For the vim.ui.input error, you're just going to have to change how you set the winbar. Right now you're doing it on CursorMoved, so it runs as soon as the input float window is opened, and critically, before the filetype is set. This is why I recommended using some of those other exclusion rules, like unnamed buffers or floating windows. Probably the safest thing would be to check the height of the window before setting it. Or you could wrap the call to nvim_buf_set_option with pcall to silence the error.
@stevearc Thanks, everything works as expected now. Checking if window is floating helped fixing this error.
Describe the bug A clear and concise description of what the bug is.
System information
vim.ui.select
backend? If so, which one? nuiTo Reproduce Steps to reproduce the behavior:
If possible, provide a minimal file that will trigger the issue (see tests/manual for examples of short ways to call
vim.ui.*
):Somehow it works good with test. Just breaks when using my config and code actions/rename.
Screenshots
Additional context I have winbar configured with nvim 0.8 and then
nui
backed stops working and each time I try to use code action with vim.ui.select or rename with vim.ui.input it throws error.Looks like winbar is trying to be attached to nui window and it doesn't have enough space or sth like that. I've added "DressingInput" filetype and "DressingSelect" filetype to excluded of winbar but it still doesn't work. I can tell that it works great with Telescope (which has filetype of TelescopePrompt) added to excluded filetypes.
My autocmd for winbar:
I also realized that if the error shows, sometimes "Code actions" are showing and when I click enter everything seems to work fine. Just error is showing each time:
Then press enter and it shows correctly:
Same with vim.ui.input.
Does anyone else have this issue when using winbar with nui prompt?