fix(terminal): check win valid before creating a new terminal (#1927)

## Description

Checking the win vaild also before creating a new terminal

## Related Issue(s)

  - Fixes #1926

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
This commit is contained in:
SheffeyG 2025-10-19 16:25:34 +08:00 committed by GitHub
parent 8abbb9e6e0
commit ba7bbcd0df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -701,7 +701,7 @@ function M:open_win()
elseif position == "current" then
self.win = vim.api.nvim_get_current_win()
else
local parent = self.opts.win or 0
local parent = self.opts.win and vim.api.nvim_win_is_valid(self.opts.win) and self.opts.win or 0
local vertical = position == "left" or position == "right"
if parent == 0 then
for _, win in ipairs(vim.api.nvim_tabpage_list_wins(0)) do