gorbit99 / codewindow.nvim

MIT License
432 stars 16 forks source link

Invalid window id when trying to edit files in floating window with codewindow.nvim open #8

Closed nyngwang closed 1 year ago

nyngwang commented 1 year ago

I got the following error message when I try to edit a buffer:

Error executing vim.schedule lua callback: ...k/packer/start/codewindow.nvim/lua/codewindow/window.lua:67: Invalid window id: 1026
stack traceback:
        [C]: in function 'nvim_win_get_buf'
        ...k/packer/start/codewindow.nvim/lua/codewindow/window.lua:67: in function ''
        vim/_editor.lua: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Screencast:

nyngwang commented 1 year ago

I just worked around this by calling close_minimap() before creating the floating window and open_minimap() again when the floating window did get created.

Maybe this is caused by the fact that minimap is still tracking the old window which has been closed. Not sure.


Also, during the debugging I found a related issue about the positioning of the minimap that I need to add

vim.api.nvim_feedkeys('jk', 'n', true)

to simulate my cursor moving after opening the floating window so that the minimap will move to the right position of the floating window. Without this line the result will look like this:

dsully commented 1 year ago

I'm seeing this too when using https://github.com/linty-org/key-menu.nvim and it opens a floating window.

gorbit99 commented 1 year ago

Please check if this works now after the fix for #9

dsully commented 1 year ago

Working for me now. Thanks for the fix!