akinsho / akinsho/bufferline.nvim

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

Đang mở
#1,030 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Lua
Star
4.4k
Fork
240
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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_

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.