utilyre / barbecue.nvim

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

[BUG]: Custom leading section with window number not updated #112

Open adonespitogo opened 3 months ago

adonespitogo commented 3 months ago

Requirements

Expected Behavior

I added a custom leading section that shows the window number. When I open a new file, it should update the window numbers shown for each winbar.

Actual Behavior

But when I open nerd-tree open a file in split window, the window number of the previously opened windows are not updating. This is because in the autocmd.lua it is calling ui.update() without a window number (nil value), thus it will only update the current open window.

Neovim Version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info

### Minimal Configuration

```Lua
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- do not remove the colorscheme!
  "folke/tokyonight.nvim",

  {
    "utilyre/barbecue.nvim",
    dependencies = {
      "neovim/nvim-lspconfig",
      "SmiteshP/nvim-navic",
      "nvim-tree/nvim-web-devicons",
    },
    config = function() 
        require("barbecue").setup({
            show_dirname = false,
            show_basename = true,
            show_modified = true,
            show_diagnostics = true,
            lead_custom_section = function(_, winr)
                return " " .. vim.api.nvim_win_get_number(winr) .. " "
            end,
        })

    end,
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])

Reproduction

  1. Open a file
  2. Open another file in split view
  3. See the window numbers become duplicate because the old one is not updated.