|
150 | 150 | -- @param effective_term_config table Configuration for split_side and split_width_percentage. |
151 | 151 | -- @return boolean True if successful, false otherwise. |
152 | 152 | local function open_fallback_terminal(cmd_string, env_table, effective_term_config) |
153 | | - if is_fallback_terminal_valid() then -- Should not happen if called correctly, but as a safeguard |
| 153 | + if is_fallback_terminal_window_valid() then -- Should not happen if called correctly, but as a safeguard |
154 | 154 | vim.api.nvim_set_current_win(managed_fallback_terminal_winid) |
155 | 155 | vim.cmd("startinsert") |
156 | 156 | return true |
|
240 | 240 | --- Closes the managed fallback terminal if it's open and valid. |
241 | 241 | -- @local |
242 | 242 | local function close_fallback_terminal() |
243 | | - if is_fallback_terminal_valid() then |
| 243 | + if is_fallback_terminal_window_valid() then |
244 | 244 | -- Closing the window should trigger on_exit of the job if the process is still running, |
245 | 245 | -- which then calls cleanup_fallback_terminal_state. |
246 | 246 | -- If the job already exited, on_exit would have cleaned up. |
|
253 | 253 | --- Focuses the managed fallback terminal if it's open and valid. |
254 | 254 | -- @local |
255 | 255 | local function focus_fallback_terminal() |
256 | | - if is_fallback_terminal_valid() then |
| 256 | + if is_fallback_terminal_window_valid() then |
257 | 257 | vim.api.nvim_set_current_win(managed_fallback_terminal_winid) |
258 | 258 | vim.cmd("startinsert") |
259 | 259 | end |
@@ -410,7 +410,9 @@ function M.close() |
410 | 410 | -- managed_snacks_terminal will be set to nil by the on_close callback |
411 | 411 | end |
412 | 412 | elseif provider == "native" then |
413 | | - close_fallback_terminal() |
| 413 | + if is_fallback_terminal_window_valid() then |
| 414 | + close_fallback_terminal() |
| 415 | + end |
414 | 416 | end |
415 | 417 | end |
416 | 418 |
|
@@ -505,7 +507,7 @@ function M.get_active_terminal_bufnr() |
505 | 507 | end |
506 | 508 | end |
507 | 509 |
|
508 | | - if is_fallback_terminal_valid() then |
| 510 | + if is_fallback_terminal_buffer_valid() then |
509 | 511 | return managed_fallback_terminal_bufnr |
510 | 512 | end |
511 | 513 |
|
|
0 commit comments