vim9script var win: number def Hide() popup_hide(win) enddef popup_create(repeat([repeat('x', 50)], 10), { filter: (_, k) => { if k == "o" Hide() tabnew endif return true } })
Run it, then press o key. Back to previous tab. You will find that the popup windows is not hidden.
The popup windows is hidden in previous condition.
9.2.0219
MS-Windows
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Hi @mao-yining, thanks for the report!
I think the issue might be in the script itself — the return value of popup_create() is not being assigned to win, so win stays at 0. This means popup_hide(win) is effectively calling popup_hide(0), which doesn't find any popup and does nothing.
The popup appears to disappear when you press o because tabnew switches to a new tab page, and the popup belongs to the original tab — so it's simply not visible on the new tab. When you close the tab with :q and return, the popup was never actually hidden, so it shows up again.
To fix it, you just need to capture the return value:
vim9script var win: number def Hide() popup_hide(win) enddef
win = popup_create(repeat([repeat('x', 50)], 10), {
filter: (_, k) => { if k == "o" Hide() tabnew endif return true } })
With win = popup_create(...), the popup should stay hidden after closing the new tab. Could you give this a try and see if it resolves the issue?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Just to clarify — this is not a Vim bug but a script bug, so the bug label can probably be removed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Thanks. I'm sorry for that.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()