diff src/popupwin.c @ 16796:5f98d80d116a v8.1.1400

patch 8.1.1400: using global pointer for tab-local popups is clumsy commit https://github.com/vim/vim/commit/9c27b1c6d140ca824a78654c1cb70a43a69b4ec6 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 26 18:48:13 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 May 2019 19:00:04 +0200
parents ddfa924df50d
children 12e3a3afdb6a
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -85,8 +85,8 @@ f_popup_create(typval_T *argvars, typval
     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(int id)
 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 @@ close_all_popups(void)
 {
     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