akinsho / akinsho/bufferline.nvim

[Bug]: highlights are not fully reloaded on ColorScheme autocmd

未關閉
#1,030 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Lua
星號
4.4k
分支
240
PR 合併指標
30 天內沒有已合併 PR

描述

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

I'm using [vscode](https://github.com/Mofiqul/vscode.nvim) theme with [auto-dark-mode.nvim](https://github.com/Mofiqul/vscode.nvim) plugin to sync nvim theme with OS dark mode preferences.

After switching vscode styles between dark and light themes, I call `vim.cmd('doautocmd ColorScheme')` to trigger highlights reload.

The bufferline reacts to `ColorScheme` event but does only partial highlights reload.\
Some highlights are still out-of-date, which causes a following appearance bug:

Image

*Switched from light to dark*

Image

*Switched from dark to light*

Here is a sample of highlights that are out of date:

Image

### What did you expect to happen?

Bufferline fully reloads its own highlights when `ColorScheme` autocmd is fired.

As workaround, I tried to manually remove old highlights and reload them as plugin does under the hood:

```lua
local all_highlights = vim.api.nvim_get_hl(0, {})

for name, _ in pairs(all_highlights) do
if name:match('^BufferLine') then
vim.api.nvim_set_hl(0, name, {})
end
end

local kfg = require('bufferline.config')
kfg.update_highlights()
```

Unfortunately this just removes highlights, but doesn't restore them.

### Config

```lua
{
'akinsho/bufferline.nvim',
version = '^4.9.1',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
---@module 'bufferline'
---@type bufferline.userconfig
opts = {
options = {
mode = 'buffers',
diagnostics = 'nvim_lsp',
offsets = {
-- possibly dapui_stacks, bapui_breakpoints, dapui_scopes, dapui_console, dap-repl
{
filetype = 'neo-tree',
text_align = 'left',
separator = true,
},
{
filetype = 'dapui_watches',
text_align = 'left',
separator = true,
},
},
},
},
init = function()
vim.opt.termguicolors = true
end,
},
```

### Additional Information

My neovim config: https://github.com/x1unix/dotfiles/tree/master/common/config/nvim

### commit

_No response_

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。