aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/popupmnu.c
diff options
context:
space:
mode:
authorYatao Li <yatli@microsoft.com>2020-02-24 16:40:58 +0800
committerYatao Li <yatli@microsoft.com>2020-04-28 01:52:02 +0800
commit630ec6cfb8670607ddfc67dd4e56e98c17746ca6 (patch)
tree68b5436a3c5a94d8233ae4edd7b906f35e24608f /src/nvim/popupmnu.c
parentd90a92bcd3c18111abb62a57192c9e151839a7f4 (diff)
downloadrneovim-630ec6cfb8670607ddfc67dd4e56e98c17746ca6.tar.gz
rneovim-630ec6cfb8670607ddfc67dd4e56e98c17746ca6.tar.bz2
rneovim-630ec6cfb8670607ddfc67dd4e56e98c17746ca6.zip
API/UI: Allow UI to set PUM position and size, and pass the position to CompleteChanged
Diffstat (limited to 'src/nvim/popupmnu.c')
-rw-r--r--src/nvim/popupmnu.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index da34d85c00..9568f319b4 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -908,10 +908,18 @@ void pum_set_event_info(dict_T *dict)
if (!pum_visible()) {
return;
}
- tv_dict_add_nr(dict, S_LEN("height"), pum_height);
- tv_dict_add_nr(dict, S_LEN("width"), pum_width);
- tv_dict_add_nr(dict, S_LEN("row"), pum_row);
- tv_dict_add_nr(dict, S_LEN("col"), pum_col);
+ int w,h,r,c;
+ if (!ui_pum_get_pos(&w, &h, &r, &c)){
+ tv_dict_add_nr(dict, S_LEN("height"), pum_height);
+ tv_dict_add_nr(dict, S_LEN("width"), pum_width);
+ tv_dict_add_nr(dict, S_LEN("row"), pum_row);
+ tv_dict_add_nr(dict, S_LEN("col"), pum_col);
+ } else {
+ tv_dict_add_nr(dict, S_LEN("height"), h);
+ tv_dict_add_nr(dict, S_LEN("width"), w);
+ tv_dict_add_nr(dict, S_LEN("row"), r);
+ tv_dict_add_nr(dict, S_LEN("col"), c);
+ }
tv_dict_add_nr(dict, S_LEN("size"), pum_size);
tv_dict_add_special(dict, S_LEN("scrollbar"),
pum_scrollbar ? kSpecialVarTrue : kSpecialVarFalse);