patch 8.1.1673: cannot easily find the popup window at a certain position
Problem: Cannot easily find the popup window at a certain position.
Solution: Add popup_locate().
diff --git a/src/popupwin.c b/src/popupwin.c
index aa19a5d..ea85588 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -1890,6 +1890,20 @@
win_valid(wp) && (wp->w_popup_flags & POPF_HIDDEN) == 0);
}
}
+/*
+ * popup_locate({row}, {col})
+ */
+ void
+f_popup_locate(typval_T *argvars, typval_T *rettv)
+{
+ int row = tv_get_number(&argvars[0]) - 1;
+ int col = tv_get_number(&argvars[1]) - 1;
+ win_T *wp;
+
+ wp = mouse_find_win(&row, &col, FIND_POPUP);
+ if (WIN_IS_POPUP(wp))
+ rettv->vval.v_number = wp->w_id;
+}
/*
* For popup_getoptions(): add a "border" or "padding" entry to "dict".