diff src/popupwin.c @ 17545:1e45331bd2ab v8.1.1770

patch 8.1.1770: cannot get the window ID of the popup preview window commit https://github.com/vim/vim/commit/56c0c4749d58e9331b212c38df46e2993d5d97c1 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 28 17:57:43 2019 +0200 patch 8.1.1770: cannot get the window ID of the popup preview window Problem: Cannot get the window ID of the popup preview window. Solution: Add popup_getpreview().
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Jul 2019 18:00:05 +0200
parents a5427e35d0fb
children 8cca2654d459
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -3019,7 +3019,15 @@ popup_find_preview_window(void)
     for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next)
 	if (wp->w_p_pvw)
 	    return wp;
-    return wp;
+    return NULL;
+}
+
+    void
+f_popup_getpreview(typval_T *argvars UNUSED, typval_T *rettv)
+{
+    win_T   *wp = popup_find_preview_window();
+
+    rettv->vval.v_number = wp == NULL ? 0 : wp->w_id;
 }
 
     int