akinsho / akinsho/bufferline.nvim

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

Open
#720 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Lua
Stars
4.4k
Forks
240
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.