Closed thunder-coding closed 5 months ago
I haven't looked into this yet, but perhaps I can suggest alternative workflows in the meantime:
:BufferCloseAllButCurrent
:BufferCloseAllButVisible
:BufferCloseAllButPinned
:BufferCloseAllButCurrentOrPinned
:BufferCloseBuffersLeft
:BufferCloseBuffersRight
:BufferPickDelete
These commands should not exhibit this behavior.
Minimal repro: nvim -u minimal.lua a b c d -S script.lua
minimal.lua
vim.opt.rtp:append '~/.local/share/nvim/lazy/barbar.nvim'
require'barbar'.setup { icons = { filetype = { enabled = false } } }
script.lua
for i = 1, 100 do vim.cmd.BufferClose() end
I reverted the fix, the approach was adding too much complexity. I'll fix in a follow-up PR.
I've opened #573 to fix the underlying issue, I'll run with it in my config for a day before merging.
I reverted the fix, the approach was adding too much complexity. I'll fix in a follow-up PR.
Can you speak more as to what the previous approach was preventing? If the vim.loop
strategy was unreliable it'll be good for me to know for the future 😅
Too much complexity :( I know I said ok initially, but it was hard to reason about what was going on with the semaphore and the asynchronous mutation, and there were many edge-cases such as the ones you found in your follow-up PR, but I've also seen other weird behavior with buffer closing this last week. Notable one case where buffers would glitch and jitter very fast non-stop after closing a buffer. Had to restart my editor 2-3 times. Didn't investigate as I've been busy, but it felt better to revert and rework the approach.
I've added a .will_close
flag that we set at bdelete and then consider those buffers as gone. This is trivial to understand and debug, compared to the semaphore + loop thing to close buffers asynchronously.
Description
Closing tabs too quickly causes race conditions in barbar.lua
To Reproduce
init.lua:
Steps to reproduce the behavior:
Screenshots
Informations
nvim --version
::checkhealth
output:OS: Arch Linux (all packages up to date)