mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(extui): check if buffers/windows exist before deleting (#34886)
Problem: Disabling vim._extui may try to delete non-existent windows/buffers. Solution: Check that window/buffer is valid before deleting.
This commit is contained in:
		| @@ -65,11 +65,15 @@ function M.enable(opts) | ||||
|   if ext.cfg.enable == false then | ||||
|     -- Detach and cleanup windows, buffers and autocommands. | ||||
|     for _, win in pairs(ext.wins) do | ||||
|       if api.nvim_win_is_valid(win) then | ||||
|         api.nvim_win_close(win, true) | ||||
|       end | ||||
|     end | ||||
|     for _, buf in pairs(ext.bufs) do | ||||
|       if api.nvim_buf_is_valid(buf) then | ||||
|         api.nvim_buf_delete(buf, {}) | ||||
|       end | ||||
|     end | ||||
|     api.nvim_clear_autocmds({ group = ext.augroup }) | ||||
|     vim.ui_detach(ext.ns) | ||||
|     return | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tomasz N
					Tomasz N