patch 8.1.1400: using global pointer for tab-local popups is clumsy
Problem: Using global pointer for tab-local popups is clumsy.
Solution: Use the pointer in tabpage_T.
diff --git a/src/popupwin.c b/src/popupwin.c
index 294f3b1..5439c64 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -85,8 +85,8 @@
if (nr == 0)
{
// popup on current tab
- wp->w_next = first_tab_popupwin;
- first_tab_popupwin = wp;
+ wp->w_next = curtab->tp_first_popupwin;
+ curtab->tp_first_popupwin = wp;
}
else if (nr < 0)
{
@@ -212,13 +212,9 @@
popup_close_tabpage(tabpage_T *tp, int id)
{
win_T *wp;
- win_T **root;
+ win_T **root = &tp->tp_first_popupwin;
win_T *prev = NULL;
- if (tp == curtab)
- root = &first_tab_popupwin;
- else
- root = &tp->tp_first_popupwin;
for (wp = *root; wp != NULL; prev = wp, wp = wp->w_next)
if (wp->w_id == id)
{
@@ -237,8 +233,8 @@
{
while (first_popupwin != NULL)
popup_close(first_popupwin->w_id);
- while (first_tab_popupwin != NULL)
- popup_close(first_tab_popupwin->w_id);
+ while (curtab->tp_first_popupwin != NULL)
+ popup_close(curtab->tp_first_popupwin->w_id);
}
void