summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-26 16:58:51 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-26 16:58:51 +0100
commit5416232707349d5f24294178f47544f2024b73ed (patch)
treeffd1dfb8b7cef3e448a4b6d08644fce7d45931ab /src
parent074fbd413172edc6f4936296a28bf8fd5cdfa38b (diff)
patch 9.0.0279: the tiny version has the popup menu but not 'wildmenu'v9.0.0279
Problem: The tiny version has the popup menu but not 'wildmenu'. Solution: Graduate the wildmenu feature.
Diffstat (limited to 'src')
-rw-r--r--src/cmdexpand.c20
-rw-r--r--src/drawscreen.c9
-rw-r--r--src/evalfunc.c10
-rw-r--r--src/ex_getln.c54
-rw-r--r--src/feature.h8
-rw-r--r--src/globals.h6
-rw-r--r--src/highlight.c4
-rw-r--r--src/option.h2
-rw-r--r--src/optiondefs.h4
-rw-r--r--src/popupmenu.c2
-rw-r--r--src/screen.c2
-rw-r--r--src/version.c6
12 files changed, 13 insertions, 114 deletions
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index cdf83955c1..a62c6abf61 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -26,7 +26,6 @@ static int ExpandUserDefined(char_u *pat, expand_T *xp, regmatch_T *regmatch, ch
static int ExpandUserList(expand_T *xp, char_u ***matches, int *numMatches);
#endif
-#ifdef FEAT_WILDMENU
// "compl_match_array" points the currently displayed list of entries in the
// popup menu. It is NULL when there is no popup menu.
static pumitem_T *compl_match_array = NULL;
@@ -34,7 +33,6 @@ static int compl_match_arraysize;
// First column in cmdline of the matched item for completion.
static int compl_startcol;
static int compl_selected;
-#endif
#define SHOW_FILE_TEXT(m) (showtail ? sm_gettail(matches[m]) : matches[m])
@@ -305,8 +303,6 @@ nextwild(
return OK;
}
-#if defined(FEAT_WILDMENU) || defined(PROTO)
-
/*
* Create and display a cmdline completion popup menu with items from
* 'matches'.
@@ -405,7 +401,6 @@ int cmdline_compl_startcol(void)
{
return compl_startcol;
}
-#endif
/*
* Get the next or prev cmdline completion match. The index of the match is set
@@ -488,7 +483,6 @@ get_next_or_prev_match(
else
findex = -1;
}
-#ifdef FEAT_WILDMENU
if (compl_match_array)
{
compl_selected = findex;
@@ -497,7 +491,6 @@ get_next_or_prev_match(
else if (p_wmnu)
win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files,
findex, cmd_showtail);
-#endif
*p_findex = findex;
if (findex == -1)
@@ -902,16 +895,12 @@ showmatches(expand_T *xp, int wildmenu UNUSED)
showtail = cmd_showtail;
}
-#ifdef FEAT_WILDMENU
if (wildmenu && vim_strchr(p_wop, WOP_PUM) != NULL)
// cmdline completion popup menu (with wildoptions=pum)
return cmdline_pum_create(ccline, xp, matches, numMatches, showtail);
-#endif
-#ifdef FEAT_WILDMENU
if (!wildmenu)
{
-#endif
msg_didany = FALSE; // lines_left will be set
msg_start(); // prepare for paging
msg_putchar('\n');
@@ -919,16 +908,12 @@ showmatches(expand_T *xp, int wildmenu UNUSED)
cmdline_row = msg_row;
msg_didany = FALSE; // lines_left will be set again
msg_start(); // prepare for paging
-#ifdef FEAT_WILDMENU
}
-#endif
if (got_int)
got_int = FALSE; // only int. the completion, not the cmd line
-#ifdef FEAT_WILDMENU
else if (wildmenu)
win_redr_status_matches(xp, numMatches, matches, -1, showtail);
-#endif
else
{
// find the length of the longest file name
@@ -3378,8 +3363,6 @@ globpath(
vim_free(buf);
}
-#ifdef FEAT_WILDMENU
-
/*
* Translate some keys pressed when 'wildmenu' is used.
*/
@@ -3392,7 +3375,6 @@ wildmenu_translate_key(
{
int c = key;
-#ifdef FEAT_WILDMENU
if (cmdline_pum_active())
{
// When the popup menu is used for cmdline completion:
@@ -3409,7 +3391,6 @@ wildmenu_translate_key(
default: break;
}
}
-#endif
if (did_wild_list)
{
@@ -3669,7 +3650,6 @@ wildmenu_cleanup(cmdline_info_T *cclp)
if (cclp->input_fn)
RedrawingDisabled = old_RedrawingDisabled;
}
-#endif
#if defined(FEAT_EVAL) || defined(PROTO)
/*
diff --git a/src/drawscreen.c b/src/drawscreen.c
index ff0f2eaebd..de091e81d8 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -3084,19 +3084,16 @@ redraw_after_callback(int call_update_screen, int do_message)
}
else if (State & MODE_CMDLINE)
{
-#ifdef FEAT_WILDMENU
if (pum_visible())
cmdline_pum_display();
-#endif
+
// Don't redraw when in prompt_for_number().
if (cmdline_row > 0)
{
// Redrawing only works when the screen didn't scroll. Don't clear
// wildmenu entries.
if (msg_scrolled == 0
-#ifdef FEAT_WILDMENU
&& wild_menu_showing == 0
-#endif
&& call_update_screen)
update_screen(0);
@@ -3241,12 +3238,10 @@ redraw_buf_and_status_later(buf_T *buf, int type)
{
win_T *wp;
-#ifdef FEAT_WILDMENU
if (wild_menu_showing != 0)
// Don't redraw while the command line completion is displayed, it
// would disappear.
return;
-#endif
FOR_ALL_WINDOWS(wp)
{
if (wp->w_buffer == buf)
@@ -3305,7 +3300,6 @@ redraw_statuslines(void)
draw_tabline();
}
-#if defined(FEAT_WILDMENU) || defined(PROTO)
/*
* Redraw all status lines at the bottom of frame "frp".
*/
@@ -3327,7 +3321,6 @@ win_redraw_last_status(frame_T *frp)
win_redraw_last_status(frp);
}
}
-#endif
/*
* Changed something in the current window, at buffer line "lnum", that
diff --git a/src/evalfunc.c b/src/evalfunc.c
index a41e6758af..230ea0d8e2 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -6261,13 +6261,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#endif
},
{"wildignore", 1},
- {"wildmenu",
-#ifdef FEAT_WILDMENU
- 1
-#else
- 0
-#endif
- },
+ {"wildmenu", 1},
{"windows", 1},
{"winaltkeys",
#ifdef FEAT_WAK
@@ -10600,10 +10594,8 @@ f_visualmode(typval_T *argvars, typval_T *rettv)
static void
f_wildmenumode(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
-#ifdef FEAT_WILDMENU
if (wild_menu_showing || ((State & MODE_CMDLINE) && cmdline_pum_active()))
rettv->vval.v_number = 1;
-#endif
}
/*
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 022c40516d..2ef66abb19 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -920,17 +920,10 @@ cmdline_wildchar_complete(
if (xp->xp_numfiles > 1
&& !*did_wild_list
&& ((wim_flags[wim_index] & WIM_LIST)
-#ifdef FEAT_WILDMENU
- || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0)
-#endif
- ))
+ || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0)))
{
-#ifdef FEAT_WILDMENU
(void)showmatches(xp,
p_wmnu && ((wim_flags[wim_index] & WIM_LIST) == 0));
-#else
- (void)showmatches(xp, FALSE);
-#endif
redrawcmd();
*did_wild_list = TRUE;
}
@@ -958,9 +951,7 @@ cmdline_wildchar_complete(
(void)vpeekc(); // remove <C-C> from input stream
got_int = FALSE; // don't abandon the command line
(void)ExpandOne(xp, NULL, NULL, 0, WILD_FREE);
-#ifdef FEAT_WILDMENU
xp->xp_context = EXPAND_NOTHING;
-#endif
*wim_index_p = wim_index;
return CMDLINE_CHANGED;
}
@@ -975,29 +966,20 @@ cmdline_wildchar_complete(
if (wim_flags[0] == WIM_LONGEST && ccline.cmdpos == j)
wim_index = 1;
if ((wim_flags[wim_index] & WIM_LIST)
-#ifdef FEAT_WILDMENU
- || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0)
-#endif
- )
+ || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0))
{
if (!(wim_flags[0] & WIM_LONGEST))
{
-#ifdef FEAT_WILDMENU
int p_wmnu_save = p_wmnu;
+
p_wmnu = 0;
-#endif
+
// remove match
nextwild(xp, WILD_PREV, 0, escape);
-#ifdef FEAT_WILDMENU
p_wmnu = p_wmnu_save;
-#endif
}
-#ifdef FEAT_WILDMENU
(void)showmatches(xp, p_wmnu
&& ((wim_flags[wim_index] & WIM_LIST) == 0));
-#else
- (void)showmatches(xp, FALSE);
-#endif
redrawcmd();
*did_wild_list = TRUE;
if (wim_flags[wim_index] & WIM_LONGEST)
@@ -1008,10 +990,8 @@ cmdline_wildchar_complete(
else
vim_beep(BO_WILD);
}
-#ifdef FEAT_WILDMENU
else if (xp->xp_numfiles == -1)
xp->xp_context = EXPAND_NOTHING;
-#endif
}
if (wim_index < 3)
++wim_index;
@@ -1895,7 +1875,6 @@ getcmdline_int(
if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
c = Ctrl_P;
-#ifdef FEAT_WILDMENU
if (p_wmnu)
c = wildmenu_translate_key(&ccline, c, &xpc, did_wild_list);
@@ -1913,7 +1892,6 @@ getcmdline_int(
c = Ctrl_E;
}
}
-#endif
// The wildmenu is cleared if the pressed key is not used for
// navigating the wild menu (i.e. the key is not 'wildchar' or
@@ -1922,36 +1900,26 @@ getcmdline_int(
// also used to navigate the menu.
end_wildmenu = (!(c == p_wc && KeyTyped) && c != p_wcm
&& c != Ctrl_N && c != Ctrl_P && c != Ctrl_A && c != Ctrl_L);
-#ifdef FEAT_WILDMENU
end_wildmenu = end_wildmenu && (!cmdline_pum_active() ||
(c != K_PAGEDOWN && c != K_PAGEUP
&& c != K_KPAGEDOWN && c != K_KPAGEUP));
-#endif
// free expanded names when finished walking through matches
if (end_wildmenu)
{
-#ifdef FEAT_WILDMENU
if (cmdline_pum_active())
cmdline_pum_remove();
-#endif
if (xpc.xp_numfiles != -1)
(void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE);
did_wild_list = FALSE;
-#ifdef FEAT_WILDMENU
if (!p_wmnu || (c != K_UP && c != K_DOWN))
-#endif
xpc.xp_context = EXPAND_NOTHING;
wim_index = 0;
-#ifdef FEAT_WILDMENU
wildmenu_cleanup(&ccline);
-#endif
}
-#ifdef FEAT_WILDMENU
if (p_wmnu)
c = wildmenu_process_key(&ccline, c, &xpc);
-#endif
// CTRL-\ CTRL-N goes to Normal mode, CTRL-\ CTRL-G goes to Insert
// mode when 'insertmode' is set, CTRL-\ e prompts for an expression.
@@ -2035,18 +2003,11 @@ getcmdline_int(
{
if (xpc.xp_numfiles > 1
&& ((!did_wild_list && (wim_flags[wim_index] & WIM_LIST))
-#ifdef FEAT_WILDMENU
- || p_wmnu
-#endif
- ))
+ || p_wmnu))
{
-#ifdef FEAT_WILDMENU
// Trigger the popup menu when wildoptions=pum
showmatches(&xpc, p_wmnu
&& ((wim_flags[wim_index] & WIM_LIST) == 0));
-#else
- (void)showmatches(&xpc, FALSE);
-#endif
}
if (nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK
&& nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK)
@@ -2318,12 +2279,11 @@ getcmdline_int(
goto cmdline_not_changed;
case Ctrl_A: // all matches
-#ifdef FEAT_WILDMENU
if (cmdline_pum_active())
// As Ctrl-A completes all the matches, close the popup
// menu (if present)
cmdline_pum_cleanup(&ccline);
-#endif
+
if (nextwild(&xpc, WILD_ALL, 0, firstc != '@') == FAIL)
break;
xpc.xp_context = EXPAND_NOTHING;
@@ -2359,7 +2319,6 @@ getcmdline_int(
case K_KPAGEUP:
case K_PAGEDOWN:
case K_KPAGEDOWN:
-#ifdef FEAT_WILDMENU
if (cmdline_pum_active()
&& (c == K_PAGEUP || c == K_PAGEDOWN ||
c == K_KPAGEUP || c == K_KPAGEDOWN))
@@ -2374,7 +2333,6 @@ getcmdline_int(
goto cmdline_not_changed;
}
else
-#endif
{
res = cmdline_browse_history(c, firstc, &lookfor, histype,
&hiscnt, &xpc);
diff --git a/src/feature.h b/src/feature.h
index 529ada57a1..ebd5dbc252 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -119,6 +119,7 @@
* +file_in_path "gf" and "<cfile>" commands.
* +path_extra up/downwards searching in 'path' and 'tags'.
* +wildignore 'wildignore' and 'backupskip' options
+ * +wildmenu 'wildmenu' option
*
* Obsolete:
* +tag_old_static Old style static tags: "file:tag file ..".
@@ -339,13 +340,6 @@
#endif
/*
- * +wildmenu 'wildmenu' option
- */
-#if defined(FEAT_NORMAL)
-# define FEAT_WILDMENU
-#endif
-
-/*
* +viminfo reading/writing the viminfo file. Takes about 8Kbyte
* of code.
* VIMINFO_FILE Location of user .viminfo file (should start with $).
diff --git a/src/globals.h b/src/globals.h
index 0af3ce7367..6ea3506cdf 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1341,13 +1341,11 @@ EXTERN int redir_execute INIT(= 0); // execute() redirection
EXTERN char_u langmap_mapchar[256]; // mapping for language keys
#endif
-#ifdef FEAT_WILDMENU
EXTERN int save_p_ls INIT(= -1); // Save 'laststatus' setting
EXTERN int save_p_wmh INIT(= -1); // Save 'winminheight' setting
EXTERN int wild_menu_showing INIT(= 0);
-# define WM_SHOWN 1 // wildmenu showing
-# define WM_SCROLLED 2 // wildmenu showing with scroll
-#endif
+#define WM_SHOWN 1 // wildmenu showing
+#define WM_SCROLLED 2 // wildmenu showing with scroll
#ifdef MSWIN
EXTERN char_u toupper_tab[256]; // table for toupper()
diff --git a/src/highlight.c b/src/highlight.c
index 9fc2ed9b36..95cdb46b5a 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -204,10 +204,8 @@ static char *(highlight_init_light[]) = {
"Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta"),
CENT("WarningMsg term=standout ctermfg=DarkRed",
"WarningMsg term=standout ctermfg=DarkRed guifg=Red"),
-#ifdef FEAT_WILDMENU
CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black",
"WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"),
-#endif
#ifdef FEAT_FOLDING
CENT("Folded term=standout ctermbg=Grey ctermfg=DarkBlue",
"Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue"),
@@ -295,10 +293,8 @@ static char *(highlight_init_dark[]) = {
"Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta"),
CENT("WarningMsg term=standout ctermfg=LightRed",
"WarningMsg term=standout ctermfg=LightRed guifg=Red"),
-#ifdef FEAT_WILDMENU
CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black",
"WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"),
-#endif
#ifdef FEAT_FOLDING
CENT("Folded term=standout ctermbg=DarkGrey ctermfg=Cyan",
"Folded term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=DarkGrey guifg=Cyan"),
diff --git a/src/option.h b/src/option.h
index aeb80ce431..ab34e82a7a 100644
--- a/src/option.h
+++ b/src/option.h
@@ -1066,9 +1066,7 @@ EXTERN long p_wc; // 'wildchar'
EXTERN long p_wcm; // 'wildcharm'
EXTERN int p_wic; // 'wildignorecase'
EXTERN char_u *p_wim; // 'wildmode'
-#ifdef FEAT_WILDMENU
EXTERN int p_wmnu; // 'wildmenu'
-#endif
EXTERN long p_wh; // 'winheight'
EXTERN long p_wmh; // 'winminheight'
EXTERN long p_wmw; // 'winminwidth'
diff --git a/src/optiondefs.h b/src/optiondefs.h
index 099ad2e95b..eeb445c9ac 100644
--- a/src/optiondefs.h
+++ b/src/optiondefs.h
@@ -2758,11 +2758,7 @@ static struct vimoption options[] =
(char_u *)&p_wic, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"wildmenu", "wmnu", P_BOOL|P_VI_DEF,
-#ifdef FEAT_WILDMENU
(char_u *)&p_wmnu, PV_NONE,
-#else
- (char_u *)NULL, PV_NONE,
-#endif
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"wildmode", "wim", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
(char_u *)&p_wim, PV_NONE,
diff --git a/src/popupmenu.c b/src/popupmenu.c
index fd496c8579..512f4b3e07 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -234,12 +234,10 @@ pum_display(
max_width = pum_base_width;
// Calculate column
-#ifdef FEAT_WILDMENU
if (State == MODE_CMDLINE)
// cmdline completion popup menu
cursor_col = cmdline_compl_startcol();
else
-#endif
#ifdef FEAT_RIGHTLEFT
if (right_left)
cursor_col = curwin->w_wincol + curwin->w_width
diff --git a/src/screen.c b/src/screen.c
index abbfc2fe58..866e3e481a 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -876,7 +876,6 @@ draw_vsep_win(win_T *wp, int row)
}
}
-#ifdef FEAT_WILDMENU
static int skip_status_match_char(expand_T *xp, char_u *s);
/*
@@ -1144,7 +1143,6 @@ win_redr_status_matches(
win_redraw_last_status(topframe);
vim_free(buf);
}
-#endif
/*
* Return TRUE if the status line of window "wp" is connected to the status
diff --git a/src/version.c b/src/version.c
index 9088962d84..25999cb667 100644
--- a/src/version.c
+++ b/src/version.c
@@ -656,11 +656,7 @@ static char *(features[]) =
# endif
#endif
"+wildignore",
-#ifdef FEAT_WILDMENU
"+wildmenu",
-#else
- "-wildmenu",
-#endif
"+windows",
#ifdef FEAT_WRITEBACKUP
"+writebackup",
@@ -720,6 +716,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 279,
+/**/
278,
/**/
277,