Closed linrongbin16 closed 1 month ago
Update: this PR is ready for review now.
Actually after spend some time to study the [vim-bbye](https://github.com/moll/vim-bbye/blob/master/plugin/bbye.vim], I believe the behavior of execute window . "wincmd w"
and set_current_win(window_number)
are different, and is the root cause of this issue. But I didn't dig into the source code inside Neovim, so I can't tell the reason inside it.
This PR (#584) is using the pcall
wrapper solution to avoid throwing exception when calling set_current_win
API.
I also submit another PR (#585), it's using the execute window . "wincmd w"
code.
Both PR work correctly in my testing, I personally prefer #585, since wrap a pcall
actually just ignore the error, instead of fixing it.
Here's the screen recording of this PR:
https://github.com/romgrk/barbar.nvim/assets/6496887/c02bfbbb-5653-432f-aa16-2d7bab4c5cb7
Fix #583 .
Previous PR: #579 .
This PR try to avoid throwing exception when fail to set current window to the
window_number
variable.When testing this PR with my personal nvim config, it can really delete the
lazy-lock.json
buffer, but there shows up another error:I guess the root cause is, when delete or edit a new buffer, the command triggers the
DiagnosticChanged
autocommands.Note: I use this key mapping to test thebd", "BufferClose", {silent=true, noremap=true, desc = "Delete buffer"}
BufferClose
: `vim.keymap.set("n", "So I update the key mapping to:
"<cmd>noautocmd BufferClose<CR>"
, but thebbye
module's behavior still seems not correct!