aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui.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/ui.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/ui.c')
-rw-r--r--src/nvim/ui.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 3a5aa95ad3..e7cc3b4e36 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -235,6 +235,32 @@ int ui_pum_get_height(void)
return pum_height;
}
+bool ui_pum_get_pos(int* pwidth, int *pheight, int* prow, int* pcol)
+{
+ int w=0,h=0,r=-1,c=-1;
+ bool found = false;
+ for (size_t i = 1; i < ui_count; i++) {
+ if (!uis[i]->pum_pos) continue;
+ if (!found) {
+ w = uis[i]->pum_width;
+ h = uis[i]->pum_height;
+ r = uis[i]->pum_row;
+ c = uis[i]->pum_col;
+ found = true;
+ } else {
+ w = MIN(uis[i]->pum_width, w);
+ h = MIN(uis[i]->pum_height, h);
+ r = MIN(uis[i]->pum_row, r);
+ c = MIN(uis[i]->pum_col, c);
+ }
+ }
+ *pwidth = w;
+ *pheight = h;
+ *prow = r;
+ *pcol = c;
+ return found;
+}
+
static void ui_refresh_event(void **argv)
{
ui_refresh();