rebelot / heirline.nvim

Heirline.nvim is a no-nonsense Neovim Statusline plugin designed around recursive inheritance to be exceptionally fast and versatile.
MIT License
1.02k stars 40 forks source link

It looks like there is a code demo error in the cookbook? #140

Closed MenMensAa closed 1 year ago

MenMensAa commented 1 year ago

I found that clicking the close button in bufferlines does not update the UI.

local TablineCloseButton = {
    condition = function(self)
        return not vim.api.nvim_buf_get_option(self.bufnr, "modified")
    end,
    { provider = " " },
    {
        provider = "",
        hl = { fg = "gray" },
        on_click = {
            callback = function(_, minwid)
                vim.schedule(function()
                    vim.api.nvim_buf_delete(minwid, { force = false })
                    vim.cmd.redrawtabline()      -- It works,UI was updated as expected
                end)
                -- vim.cmd.redrawtabline()      -- Here! This line of code should be wrapped in the previous function.
            end,
            minwid = function(self)
                return self.bufnr
            end,
            name = "heirline_tabline_close_buffer_callback",
        },
    },
}
rebelot commented 1 year ago

mhh can't reproduce but should be fixed