Allow using internal popupmenu or ext_popupmenu for wildmenu

Deprecate ext_wildmenu. ext_popupmenu already contains more state (anchor
position), and will allow further expansion (info about items).
This commit is contained in:
Björn Linse
2019-03-04 10:59:44 +01:00
parent 175398f216
commit be8ebba325
19 changed files with 553 additions and 69 deletions

View File

@@ -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) {