aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/popupmnu.c
diff options
context:
space:
mode:
authorYatao Li <yatli@microsoft.com>2020-03-22 17:53:45 +0800
committerYatao Li <yatli@microsoft.com>2020-04-28 01:54:16 +0800
commite34684b2ad02e759dec39c0f0958c7882120ecdc (patch)
treecc2024053865052d34e7e8ebebbd45a4064d29ee /src/nvim/popupmnu.c
parentd372c804aa33a272f6659f6d08d5dfee704d30d9 (diff)
downloadrneovim-e34684b2ad02e759dec39c0f0958c7882120ecdc.tar.gz
rneovim-e34684b2ad02e759dec39c0f0958c7882120ecdc.tar.bz2
rneovim-e34684b2ad02e759dec39c0f0958c7882120ecdc.zip
api/ui: simplify popup menu position get/set logic; fix test
Diffstat (limited to 'src/nvim/popupmnu.c')
-rw-r--r--src/nvim/popupmnu.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index 051cd660db..532bf68190 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -902,18 +902,6 @@ int pum_get_height(void)
return pum_height;
}
-/// Gets the internal pum geometry.
-///
-/// @return the internal pum geometry. Ignores UI external pum geometry.
-/// Only valid when pum_visible() returns TRUE!
-void pum_get_internal_pos(int *pwidth, int *pheight, int *prow, int *pcol)
-{
- *pwidth = pum_width;
- *pheight = pum_height;
- *prow = pum_row;
- *pcol = pum_col;
-}
-
/// Add size information about the pum to "dict".
void pum_set_event_info(dict_T *dict)
{
@@ -921,7 +909,12 @@ void pum_set_event_info(dict_T *dict)
return;
}
double w, h, r, c;
- ui_pum_get_pos(&w, &h, &r, &c);
+ if (!ui_pum_get_pos(&w, &h, &r, &c)) {
+ w = (double)pum_width;
+ h = (double)pum_height;
+ r = (double)pum_row;
+ c = (double)pum_col;
+ }
tv_dict_add_float(dict, S_LEN("height"), h);
tv_dict_add_float(dict, S_LEN("width"), w);
tv_dict_add_float(dict, S_LEN("row"), r);