sidekick.nvim icon indicating copy to clipboard operation
sidekick.nvim copied to clipboard

bug: invalid window when toggling cli window before the cli tool initializes

Open Aqothy opened this issue 2 months ago • 0 comments

Did you check docs and existing issues?

  • [x] I have read all the sidekick.nvim docs
  • [x] I have updated the plugin to the latest version before submitting this issue
  • [x] I have searched the existing issues of sidekick.nvim
  • [x] I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.12.0-dev-1555+g1fddd74da7

Operating system/version

Mac 26.0.1

Describe the bug

when i open an ai cli tool using sidekick, if i toggle it to hide the window before the cli tool is fully initialized, i get: vim.schedule callback: ...re/nvim/lazy/sidekick.nvim/lua/sidekick/cli/terminal.lua:253: Invalid 'window': Expected Lua number stack traceback: [C]: in function 'nvim_win_get_cursor' ...re/nvim/lazy/sidekick.nvim/lua/sidekick/cli/terminal.lua:253: in function '' vim/_editor.lua: in function <vim/_editor.lua:0>

video: Image

Steps To Reproduce

  1. toggle sidekick cli
  2. toggle it again to hide the window before the ai tool fully initializes
  3. get invalid window error spam

Expected Behavior

no error when hiding sidekick cli window before it fully initializes

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
	spec = {
		{
			"folke/sidekick.nvim",
			opts = {},
			keys = {
				{
					"<c-.>",
					function()
						require("sidekick.cli").toggle()
					end,
					desc = "Sidekick Toggle",
					mode = { "n", "t", "i" },
				},
			},
		},
		-- add any other plugins here
	},
})

Aqothy avatar Nov 07 '25 01:11 Aqothy