akinsho / akinsho/bufferline.nvim

[Bug]: Offset only uses one window

Đang mở
#789 7 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?

When multiple offsets are defined, then opening a new window will only apply the offset configuration to one window, usually the leftmost one or the last one opened. It behaves oddly.

For example when having an offset for filetype "help" and an offset for filetype "NvimTree", then opening NvimTree will produce the correct behavior. If you then however open the help with `:vertical help`, the help window gets the offset configuration applied but the nvim-tree gets it's text deleted.

To reproduce:

1. Open nvim and only have one buffer open that doesn't have an offset setting for it's filetype
2. Open nvim-tree
![image](https://github.com/akinsho/bufferline.nvim/assets/16250196/3d5aa79b-5ecf-4108-b8ae-e8e86d10d006)

3. Open vertical help
![image](https://github.com/akinsho/bufferline.nvim/assets/16250196/fd5c8661-6d85-4aac-a542-8f001b3c013e)

4. Notice help doesn't get the title and instead the bufferline starts over the help window
5. Close nvim-tree
![image](https://github.com/akinsho/bufferline.nvim/assets/16250196/41801733-1b1c-4083-a1a6-20b48ecfd089)

6. Notice that help now gets the offset applied where before it did not

Windows that open on the right, such as tagbar, also behave oddly when opening and closing them mixed with opening and closing multiple windows that open on the left, such as undotree.

### What did you expect to happen?

Vertically split windows always get their header text and all the offsets are added for the bufferline, except of course for the offsets for windows on the right, which should be handled separately

### Config

```lua
-- ...
offsets = {
{
filetype = "NvimTree",
text = function()
return "NVIMTREE TEXT"
-- return vim.fn.getcwd()
end,
-- highlight = "Directory",
text_align = "left",
separator = true
},
{
filetype = "NERDTree",
text = function()
return vim.fn.getcwd()
end,
highlight = "Directory",
text_align = "left",
separator = true
},
{
filetype = "undotree",
text = "Undo Tree",
text_align = "left",
separator = true
},
{
filetype = "diff",
text = "Diff",
text_align = "left",
separator = true
},
{
filetype = "tagbar",
text = "Tags",
text_align = "left",
separator = true
},
{
filetype = "help",
text = "Help",
text_align = "left",
separator = true
}
},
-- ...
```

### Additional Information

N/A

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