Invalid window id Issue with NuiSplit #335
Unanswered
MunifTanjim
asked this question in
Q&A
Replies: 2 comments 12 replies
-
@pysan3 Can you try changing this nui.nvim/lua/nui/split/init.lua Line 168 in 35da9ca to self.winid = vim.api.nvim_win_call(self._.relative.type == 'editor' and 0 or self._.relative.win, function() and see if that works? |
Beta Was this translation helpful? Give feedback.
4 replies
-
May I ask you why you reference nui.nvim/lua/nui/split/utils.lua Line 68 in af7dfee Called from nui.nvim/lua/nui/split/utils.lua Line 142 in af7dfee If I'm not mistaken, |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Possibly one thing;
Suppose there are two windows (
1
and2
) side by side. When I make a newNuiSplit({ relative = "editor" }):mount()
(creates3
), it opens at the most left(/right) position.Inside
:update_layout()
inside:init()
,self._.relative
is changed to{ type = "editor", win = 1 }
.After that, I
split:hide()
and then delete window1
.When I call
split:show()
after that, the value inself._.relative.win
is required here, and since window1
is already deleted,:show()
will fail.To workaround this issue, I need to call
split:update_layout()
beforesplit:show()
to ensureself._.relative.win
is a valid window.When I'm making a split relative to the
editor
, I suppose the code shouldn't matter where to spawn the window from, so it would be more intuitive if I didn't need to call update_layout. (And it took quite a lot of time to figure out...)It would be nice if you could add some if-else based on relative settings or possibly put a caution in the document?
orignally posted by @pysan3 in #295 (comment)
Beta Was this translation helpful? Give feedback.
All reactions