Mercurial > vim
diff src/popupwin.c @ 17348:d82b0cfb1e82 v8.1.1673
patch 8.1.1673: cannot easily find the popup window at a certain position
commit https://github.com/vim/vim/commit/b4f0628fc5892e1bb9f0f780af782ff47ef277ed
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 12 21:07:54 2019 +0200
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().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 12 Jul 2019 21:15:04 +0200 |
parents | 1ac1d34bbdbf |
children | 102ed3a26a5d |
line wrap: on
line diff
--- a/src/popupwin.c +++ b/src/popupwin.c @@ -1890,6 +1890,20 @@ f_popup_getpos(typval_T *argvars, typval 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".