diff options
Diffstat (limited to 'src/nvim/popupmnu.c')
-rw-r--r-- | src/nvim/popupmnu.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index e9b3f04454..8cf09b14d7 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -66,7 +66,9 @@ static bool pum_invalid = false; // the screen was just cleared /// @param array_changed if true, array contains different items since last call /// if false, a new item is selected, but the array /// is the same -void pum_display(pumitem_T *array, int size, int selected, bool array_changed) +/// @param cmd_startcol only for cmdline mode: column of completed match +void pum_display(pumitem_T *array, int size, int selected, bool array_changed, + int cmd_startcol) { int w; int def_width; @@ -84,7 +86,8 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) if (!pum_is_visible) { // To keep the code simple, we only allow changing the // draw mode when the popup menu is not being displayed - pum_external = ui_has(kUIPopupmenu); + pum_external = ui_has(kUIPopupmenu) + || (State == CMDLINE && ui_has(kUIWildmenu)); } do { @@ -96,19 +99,26 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) above_row = 0; below_row = cmdline_row; - // anchor position: the start of the completed word - row = curwin->w_wrow; - if (curwin->w_p_rl) { - col = curwin->w_width - curwin->w_wcol - 1; + // wildoptions=pum + if (State == CMDLINE) { + row = ui_has(kUICmdline) ? 0 : cmdline_row; + col = cmd_startcol; + pum_anchor_grid = ui_has(kUICmdline) ? -1 : DEFAULT_GRID_HANDLE; } else { - col = curwin->w_wcol; - } + // anchor position: the start of the completed word + row = curwin->w_wrow; + if (curwin->w_p_rl) { + col = curwin->w_width - curwin->w_wcol - 1; + } else { + col = curwin->w_wcol; + } - pum_anchor_grid = (int)curwin->w_grid.handle; - if (!ui_has(kUIMultigrid)) { - pum_anchor_grid = (int)default_grid.handle; - row += curwin->w_winrow; - col += curwin->w_wincol; + pum_anchor_grid = (int)curwin->w_grid.handle; + if (!ui_has(kUIMultigrid)) { + pum_anchor_grid = (int)default_grid.handle; + row += curwin->w_winrow; + col += curwin->w_wincol; + } } if (pum_external) { |