From f24afa2cef551122b8bd53bb2e4a7df42343ce2e Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sun, 14 Jan 2024 11:08:15 +1100 Subject: [PATCH] fix(#2624): open file from docked floating window (#2627) --- lua/nvim-tree/lib.lua | 2 +- lua/nvim-tree/view.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/lib.lua b/lua/nvim-tree/lib.lua index 848bdeeff63..09642281419 100644 --- a/lua/nvim-tree/lib.lua +++ b/lua/nvim-tree/lib.lua @@ -24,7 +24,7 @@ function M.get_node_at_cursor() return end - local cursor = vim.api.nvim_win_get_cursor(view.get_winnr()) + local cursor = vim.api.nvim_win_get_cursor(winnr) local line = cursor[1] if line == 1 and view.is_root_folder_visible(core.get_cwd()) then diff --git a/lua/nvim-tree/view.lua b/lua/nvim-tree/view.lua index 81fe36e96c7..387105b1af3 100644 --- a/lua/nvim-tree/view.lua +++ b/lua/nvim-tree/view.lua @@ -473,7 +473,7 @@ end function M.get_winnr(tabpage) tabpage = tabpage or vim.api.nvim_get_current_tabpage() local tabinfo = M.View.tabpages[tabpage] - if tabinfo ~= nil then + if tabinfo ~= nil and vim.api.nvim_win_is_valid(tabinfo.winnr) then return tabinfo.winnr end end