aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-09-08 10:35:09 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-12-31 12:44:22 +0100
commit16c3337122955c1e18c5ff69dcb14b61c43c4ac0 (patch)
tree446838307170e826dcd9c9dedf229e2412ae42cd
parent882dd63dc735a7826f6ee0888a404f13f6c7cb80 (diff)
downloadrneovim-16c3337122955c1e18c5ff69dcb14b61c43c4ac0.tar.gz
rneovim-16c3337122955c1e18c5ff69dcb14b61c43c4ac0.tar.bz2
rneovim-16c3337122955c1e18c5ff69dcb14b61c43c4ac0.zip
multigrid: use grid-based coordinates for ext_popupmenu
-rw-r--r--src/nvim/api/ui_events.in.h3
-rw-r--r--src/nvim/popupmnu.c17
2 files changed, 14 insertions, 6 deletions
diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h
index 8870f39721..308d5aaf02 100644
--- a/src/nvim/api/ui_events.in.h
+++ b/src/nvim/api/ui_events.in.h
@@ -87,7 +87,8 @@ void win_position(Integer win, Integer grid, Integer startrow,
Integer startcol, Integer width, Integer height)
FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY;
-void popupmenu_show(Array items, Integer selected, Integer row, Integer col)
+void popupmenu_show(Array items, Integer selected,
+ Integer row, Integer col, Integer grid)
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
void popupmenu_hide(void)
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index e9a0c7c6b4..670c794b68 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -68,12 +68,12 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed)
int kind_width;
int extra_width;
int i;
- int row;
int context_lines;
- int col;
int above_row;
int below_row;
int redo_count = 0;
+ int row;
+ int col;
if (!pum_is_visible) {
// To keep the code simple, we only allow changing the
@@ -90,13 +90,20 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed)
below_row = cmdline_row;
// anchor position: the start of the completed word
- row = curwin->w_wrow + curwin->w_winrow;
+ row = curwin->w_wrow;
if (curwin->w_p_rl) {
- col = curwin->w_wincol + curwin->w_width - curwin->w_wcol - 1;
+ col = curwin->w_width - curwin->w_wcol - 1;
} else {
col = curwin->w_wincol + curwin->w_wcol;
}
+ int grid = (int)curwin->w_grid.handle;
+ if (!ui_is_external(kUIMultigrid)) {
+ grid = (int)default_grid.handle;
+ row += curwin->w_winrow;
+ col += curwin->w_wincol;
+ }
+
if (pum_external) {
if (array_changed) {
Array arr = ARRAY_DICT_INIT;
@@ -108,7 +115,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed)
ADD(item, STRING_OBJ(cstr_to_string((char *)array[i].pum_info)));
ADD(arr, ARRAY_OBJ(item));
}
- ui_call_popupmenu_show(arr, selected, row, col);
+ ui_call_popupmenu_show(arr, selected, row, col, grid);
} else {
ui_call_popupmenu_select(selected);
}