mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00: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:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq