akinsho / akinsho/bufferline.nvim

[Bug]: First (most left) group doesn't collapse on mouse click

未关闭
#720 0 条评论 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?

If I have several groups and assume they are in the following order "code", "docs", "cfg", I can collapse all but first one by mouse click. First group remains uncollapsed. BufferLineGroupToagle code command works though.

How to reproduce:
1. Have several groups with priorities (see config below) and several files in each group
2. Click on most left group
3. Click on any other group

Expected result
1. Groups exist, files in the groups exist - OK
2. Most left group got collapsed - OK
3. Group got collapsed - OK

Actual results
1. Groups exist, files in the groups exist - OK
2. Most left group got collapsed - NOK. Group remains un-collapsed
3. Group got collapsed - OK

I.e. collapse on mouse click works well on all groups except the most left one.
BufferLineGroupToggle works on all groups.

### What did you expect to happen?

Any group should be collapsed/uncollapsed on mouse click.

### Config

```
require('bufferline').setup {
options = {
show_duplicate_prefix = true,
always_show_bufferline = false,
diagnostics = 'nvim_lsp',
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local icon = level:match("error") and " " or " "
return " " .. icon .. count
end,
indicator = {
icon = '▎', -- this should be omitted if indicator style is not 'icon'
style = 'icon',
},
offsets = {
{
filetype = "NvimTree",
text = "",
text_align = "left",
separator = false,
}
},
groups = {
options = {
toggle_hidden_on_enter = true -- when you re-enter a hidden group this options re-opens that group so the buffer is visible
},
items = {
{
name = "Tests", -- Mandatory
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
priority = 2, -- determines where it will appear relative to other groups (Optional)
icon = "", -- Optional
matcher = function(buf) -- Mandatory
return buf.filename:match('%_test.*') or buf.filename:match('%_spec')
end,
},
{
name = "Docs",
--highlight = {undercurl = false, sp = "green"},
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
priority = 3, -- determines where it will appear relative to other groups (Optional)
matcher = function(buf)
return buf.filename:match('%.md') or buf.filename:match('%.txt')
end,
},
{
name = "Cfg",
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
priority = 4, -- determines where it will appear relative to other groups (Optional)
matcher = function(buf)
return buf.filename:match('%.yaml') or buf.filename:match('%.json')
end,
},
{
name = "Code",
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
priority = 1, -- determines where it will appear relative to other groups (Optional)
matcher = function(buf)
return buf.filename:match('%.go') or buf.filename:match('%.py')
end,
}
}
},
}
}

```

### Additional Information

...

### commit

_No response_

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。