Why the popup componet render two windows? #46
-
I was trying to build a version of the popup component with toggle capabilities and I realise that the border and the popup render two different windows. Is there any reason to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello @yriveiro , if you don't use But Neovim's native window border doesn't support drawing text on top of it or doing padding. So using two windows is a trick to acheive that. I hope that answers your question. Let me know if you need any further clarification. 😃 |
Beta Was this translation helpful? Give feedback.
-
Nice work btw :) |
Beta Was this translation helpful? Give feedback.
Hello @yriveiro , if you don't use
border.text
orborder.padding
, it would render a single window and will use Neovim's native window border to do draw the border.But Neovim's native window border doesn't support drawing text on top of it or doing padding. So using two windows is a trick to acheive that.
nui.nvim
will draw the border, border text and padding on border window, and the popup window sits on top of that. It's a common trick for doing this in Neovim.I hope that answers your question. Let me know if you need any further clarification. 😃