Skip to content

Commit 61f75a7

Browse files
committed
fix(panel): jump to prev win on close
1 parent 394b5cb commit 61f75a7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lua/copilot/panel.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,16 @@ function panel:ensure_winid()
371371
group = self.augroup,
372372
pattern = tostring(self.winid),
373373
callback = function()
374+
local should_jump_to_prev_win = self.winid == vim.api.nvim_get_current_win()
375+
374376
self.panelId = nil
375377
self.state = { entries = {} }
376378
vim.api.nvim_clear_autocmds({ group = self.augroup })
377379
self.winid = nil
380+
381+
if should_jump_to_prev_win then
382+
vim.cmd("wincmd p")
383+
end
378384
end,
379385
desc = "[copilot] (panel) win closed cleanup",
380386
once = true,

0 commit comments

Comments
 (0)