[vim/vim] Popup window not always hidden when popup_hide is called after tabnew (Issue #19778)

5 views
Skip to first unread message

Mao-Yining

unread,
Mar 20, 2026, 10:35:35 PM (7 days ago) Mar 20
to vim/vim, Subscribed
mao-yining created an issue (vim/vim#19778)

Steps to reproduce

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.

Expected behaviour

The popup windows is hidden in previous condition.

Version of Vim

9.2.0219

Environment

MS-Windows

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19778@github.com>

mattn

unread,
Mar 22, 2026, 10:26:50 AM (6 days ago) Mar 22
to vim/vim, Subscribed
mattn left a comment (vim/vim#19778)

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.Message ID: <vim/vim/issues/19778/4106345448@github.com>

mattn

unread,
Mar 22, 2026, 10:27:24 AM (6 days ago) Mar 22
to vim/vim, Subscribed
mattn left a comment (vim/vim#19778)

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.Message ID: <vim/vim/issues/19778/4106346322@github.com>

Mao-Yining

unread,
Mar 27, 2026, 6:18:23 AM (23 hours ago) Mar 27
to vim/vim, Subscribed

Closed #19778 as completed.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/19778/issue_event/23966906675@github.com>

Mao-Yining

unread,
Mar 27, 2026, 6:18:23 AM (23 hours ago) Mar 27
to vim/vim, Subscribed
mao-yining left a comment (vim/vim#19778)

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.Message ID: <vim/vim/issues/19778/4141584242@github.com>

Reply all
Reply to author
Forward
0 new messages