mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
fix(treesitter): close InspectTree/EditQuery window on BufUnload (#31036)
Problem: The window opened :InspectTree or :EditQuery isn't closed when the source buffer is unloaded, even though it is closed when the buffer is hidden. Solution: Also close the window on BufUnload.
This commit is contained in:
parent
3075c69ff0
commit
99acc9de55
@ -527,7 +527,7 @@ function M.inspect_tree(opts)
|
||||
end,
|
||||
})
|
||||
|
||||
api.nvim_create_autocmd('BufHidden', {
|
||||
api.nvim_create_autocmd({ 'BufHidden', 'BufUnload' }, {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
once = true,
|
||||
@ -665,10 +665,10 @@ function M.edit_query(lang)
|
||||
api.nvim_buf_clear_namespace(query_buf, edit_ns, 0, -1)
|
||||
end,
|
||||
})
|
||||
api.nvim_create_autocmd('BufHidden', {
|
||||
api.nvim_create_autocmd({ 'BufHidden', 'BufUnload' }, {
|
||||
group = group,
|
||||
buffer = buf,
|
||||
desc = 'Close the editor window when the source buffer is hidden',
|
||||
desc = 'Close the editor window when the source buffer is hidden or unloaded',
|
||||
once = true,
|
||||
callback = function()
|
||||
close_win(query_win)
|
||||
|
Loading…
Reference in New Issue
Block a user