Skip to content

Commit 8876747

Browse files
authored
fix(snacks): invalid window when :ClaudeCodeFocus (#64)
1 parent 91357d8 commit 8876747

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lua/claudecode/terminal/snacks.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ function M.simple_toggle(cmd_string, env_table, config)
167167
local logger = require("claudecode.logger")
168168

169169
-- Check if terminal exists and is visible
170-
if terminal and terminal:buf_valid() and terminal.win then
170+
if terminal and terminal:buf_valid() and terminal:win_valid() then
171171
-- Terminal is visible, hide it
172172
logger.debug("terminal", "Simple toggle: hiding visible terminal")
173173
terminal:toggle()
174-
elseif terminal and terminal:buf_valid() and not terminal.win then
174+
elseif terminal and terminal:buf_valid() and not terminal:win_valid() then
175175
-- Terminal exists but not visible, show it
176176
logger.debug("terminal", "Simple toggle: showing hidden terminal")
177177
terminal:toggle()
@@ -195,11 +195,11 @@ function M.focus_toggle(cmd_string, env_table, config)
195195
local logger = require("claudecode.logger")
196196

197197
-- Terminal exists, is valid, but not visible
198-
if terminal and terminal:buf_valid() and not terminal.win then
198+
if terminal and terminal:buf_valid() and not terminal:win_valid() then
199199
logger.debug("terminal", "Focus toggle: showing hidden terminal")
200200
terminal:toggle()
201201
-- Terminal exists, is valid, and is visible
202-
elseif terminal and terminal:buf_valid() and terminal.win then
202+
elseif terminal and terminal:buf_valid() and terminal:win_valid() then
203203
local claude_term_neovim_win_id = terminal.win
204204
local current_neovim_win_id = vim.api.nvim_get_current_win()
205205

0 commit comments

Comments
 (0)