@@ -167,11 +167,11 @@ function M.simple_toggle(cmd_string, env_table, config)
167
167
local logger = require (" claudecode.logger" )
168
168
169
169
-- 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
171
171
-- Terminal is visible, hide it
172
172
logger .debug (" terminal" , " Simple toggle: hiding visible terminal" )
173
173
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
175
175
-- Terminal exists but not visible, show it
176
176
logger .debug (" terminal" , " Simple toggle: showing hidden terminal" )
177
177
terminal :toggle ()
@@ -195,11 +195,11 @@ function M.focus_toggle(cmd_string, env_table, config)
195
195
local logger = require (" claudecode.logger" )
196
196
197
197
-- 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
199
199
logger .debug (" terminal" , " Focus toggle: showing hidden terminal" )
200
200
terminal :toggle ()
201
201
-- 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
203
203
local claude_term_neovim_win_id = terminal .win
204
204
local current_neovim_win_id = vim .api .nvim_get_current_win ()
205
205
0 commit comments