From 6118f91bee78ef2264f1fa5bc23119e6110749d3 Mon Sep 17 00:00:00 2001 From: qw457812 <37494864+qw457812@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:24:16 +0800 Subject: [PATCH] fix(snacks): invalid window when `:ClaudeCodeFocus` --- lua/claudecode/terminal/snacks.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/claudecode/terminal/snacks.lua b/lua/claudecode/terminal/snacks.lua index 30c2b46..ad19f41 100644 --- a/lua/claudecode/terminal/snacks.lua +++ b/lua/claudecode/terminal/snacks.lua @@ -167,11 +167,11 @@ function M.simple_toggle(cmd_string, env_table, config) local logger = require("claudecode.logger") -- Check if terminal exists and is visible - if terminal and terminal:buf_valid() and terminal.win then + if terminal and terminal:buf_valid() and terminal:win_valid() then -- Terminal is visible, hide it logger.debug("terminal", "Simple toggle: hiding visible terminal") terminal:toggle() - elseif terminal and terminal:buf_valid() and not terminal.win then + elseif terminal and terminal:buf_valid() and not terminal:win_valid() then -- Terminal exists but not visible, show it logger.debug("terminal", "Simple toggle: showing hidden terminal") terminal:toggle() @@ -195,11 +195,11 @@ function M.focus_toggle(cmd_string, env_table, config) local logger = require("claudecode.logger") -- Terminal exists, is valid, but not visible - if terminal and terminal:buf_valid() and not terminal.win then + if terminal and terminal:buf_valid() and not terminal:win_valid() then logger.debug("terminal", "Focus toggle: showing hidden terminal") terminal:toggle() -- Terminal exists, is valid, and is visible - elseif terminal and terminal:buf_valid() and terminal.win then + elseif terminal and terminal:buf_valid() and terminal:win_valid() then local claude_term_neovim_win_id = terminal.win local current_neovim_win_id = vim.api.nvim_get_current_win()