utilyre / barbecue.nvim

Visual Studio Code inspired breadcrumbs plugin for the Neovim editor
MIT License
776 stars 31 forks source link

Fix ui.update to correctly honor exclude_filetypes and include_buftypes #53

Closed braxtons12 closed 1 year ago

braxtons12 commented 1 year ago

This fixes the implementation of ui.update to correctly honor exclude_filetypes and include_buftypes so that other winbars aren't affected by barbecue. The original implementation here could trample on other winbars in windows/buffers that shouldn't have been affected by barbecue, causing them to either be hidden, have weird behavior, or otherwise show incorrectly, because exclude_filetypes and include_buftypes were being checked in the update call, not the scheduled function to actually update the winbar.

One example of the previous conflict is with NeoTree's source_selector, which even when "neo-tree" was added to exclude_filetypes, would be broken by barbecue.nvim (it would only appear when a window other than the tree was focused, and only if the focus had changed at least once since the tree was opened).

utilyre commented 1 year ago

This patch makes octo.nvim's buffer have a winbar (it shouldn't since it has a buftype of acwrite). Also has some performance drawbacks because the winbar gets generated even if the buffer/window doesn't need it.

Could you give me a minimal config in which barbecue conflicts with neo-tree? I might be able to fix this without any regressions.

braxtons12 commented 1 year ago

Here's the minimal config. https://pastebin.com/SG6SWut7

This could be easily reworked to do the check before the winbar is built, which would solve the performance problem. I honestly just didn't think of that.

braxtons12 commented 1 year ago

Moved the buftype, filetype, and visibility checks so they occur before the winbar is built. Solves the performance regression.

utilyre commented 1 year ago

Here's the minimal config. https://pastebin.com/SG6SWut7

Can't reach the website. Could you post it here or open an issue since there's already a minimal config template there.

braxtons12 commented 1 year ago

Here's the minimal config. https://pastebin.com/SG6SWut7

Can't reach the website. Could you post it here or open an issue since there's already a minimal config template there.

Done.

Is there a particular reason that you've removed these lines?

vim.wo[winnr].winbar = state.get_last_winbar(winnr)
state.clear(winnr)

These lines specifically are what breaks the winbar from Neotree. If you shouldn't be changing the winbar to begin with, there's no reason to try to restore it back to some previous state (which is a race condition): just leave it alone.

braxtons12 commented 1 year ago

Fixed with cbc4481, so this is no longer needed