Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#2624): open file from docked floating window #2627

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

alex-courtis
Copy link
Member

fixes #2624

@@ -24,7 +24,7 @@ function M.get_node_at_cursor()
return
end

local cursor = vim.api.nvim_win_get_cursor(view.get_winnr())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly necessary.

@alex-courtis alex-courtis merged commit f24afa2 into master Jan 14, 2024
4 checks passed
@alex-courtis alex-courtis deleted the 2624-float-hijack-dir branch January 14, 2024 00:08
@@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alex-courtis I'm hunting down a bug that seems to be related to this change. Can you help me out in figuring out what is the problem? 🙏

What I currently know is that when I call:

api.node.open.replace_tree_buffer

I get the following error:

E5108: Error executing lua: ...config/nvim/plugged/nvim-tree.lua/lua/nvim-tree/view.lua:476: Expected Lua number
stack traceback:
        [C]: in function 'nvim_win_is_valid'
        ...config/nvim/plugged/nvim-tree.lua/lua/nvim-tree/view.lua:476: in function 'get_winnr'
        ....config/nvim/plugged/nvim-tree.lua/lua/nvim-tree/lib.lua:22: in function 'get_node_at_cursor'
        ....config/nvim/plugged/nvim-tree.lua/lua/nvim-tree/api.lua:61: in function <....config/nvim/plugged/nvim-tree.lua/lua/nvim-tree/api.lua:60>

Do you maybe have an idea where should I look next?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change did indeed surface some issues, many thanks for digging into this!

Can you log the value of tabinfo.winnr? As of current master it's nil checked, however anything could be in there.

We could just do a type(tabinfo.winnr) == "number"...

#2628 will do away with a lot of these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Float view doen't autoclose on opening a file
2 participants