changeset 29881:0cc9a3001717 v9.0.0279

patch 9.0.0279: the tiny version has the popup menu but not 'wildmenu' Commit: https://github.com/vim/vim/commit/5416232707349d5f24294178f47544f2024b73ed Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 26 16:58:51 2022 +0100 patch 9.0.0279: the tiny version has the popup menu but not 'wildmenu' Problem: The tiny version has the popup menu but not 'wildmenu'. Solution: Graduate the wildmenu feature.
author Bram Moolenaar <Bram@vim.org>
date Fri, 26 Aug 2022 18:00:05 +0200
parents bd3aac5d1d9e
children 5454d999bbd4
files runtime/doc/options.txt runtime/doc/various.txt src/cmdexpand.c src/drawscreen.c src/evalfunc.c src/ex_getln.c src/feature.h src/globals.h src/highlight.c src/option.h src/optiondefs.h src/popupmenu.c src/screen.c src/version.c
diffstat 14 files changed, 20 insertions(+), 123 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -9047,13 +9047,13 @@ A jump table for the options with a shor
 				*'wildmenu'* *'wmnu'* *'nowildmenu'* *'nowmnu'*
 'wildmenu' 'wmnu'	boolean	(default off, set in |defaults.vim|)
 			global
-			{not available if compiled without the |+wildmenu|
-			feature}
 	When 'wildmenu' is on, command-line completion operates in an enhanced
 	mode.  On pressing 'wildchar' (usually <Tab>) to invoke completion,
-	the possible matches are shown just above the command line, with the
-	first match highlighted (overwriting the status line, if there is
-	one).  This is the behavior without "pum" in 'wildoptions'.
+	the possible matches are shown.
+	When 'wildoptions' contains "pum", then the completion matches are
+	shown in a popup menu.  Otherwise they are displayed just above the
+	command line, with the first match highlighted (overwriting the status
+	line, if there is one).
 	Keys that show the previous/next match, such as <Tab> or
 	CTRL-P/CTRL-N, cause the highlight to move to the appropriate match.
 	When 'wildmode' is used, "wildmenu" mode is used where "full" is
@@ -9062,8 +9062,6 @@ A jump table for the options with a shor
 	If there are more matches than can fit in the line, a ">" is shown on
 	the right and/or a "<" is shown on the left.  The status line scrolls
 	as needed.
-	When 'wildoptions' contains "pum", then the completion matches are
-	shown in a popup menu.
 	The "wildmenu" mode is abandoned when a key is hit that is not used
 	for selecting a completion.
 	While the "wildmenu" is active, not using the popup menu, the
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -491,7 +491,7 @@ T  *+visualextra*	extra Visual mode comm
 T  *+vreplace*		|gR| and |gr|
    *+vtp*		on MS-Windows console: support for 'termguicolors'
 T  *+wildignore*	|'wildignore'|  Always enabled since 9.0.0278
-N  *+wildmenu*		|'wildmenu'|
+T  *+wildmenu*		|'wildmenu'||  Always enabled since 9.0.0279
 T  *+windows*		more than one window; Always enabled since 8.0.1118.
 m  *+writebackup*	|'writebackup'| is default on
 m  *+xim*		X input method |xim|
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -26,7 +26,6 @@ static int	ExpandUserDefined(char_u *pat
 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 U
 	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 U
 	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)
 /*
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -3084,19 +3084,16 @@ redraw_after_callback(int call_update_sc
     }
     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, 
 {
     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
--- 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
     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
 }
 
 /*
--- 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);
--- 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 $).
--- a/src/globals.h
+++ b/src/globals.h
@@ -1341,13 +1341,11 @@ EXTERN int  redir_execute INIT(= 0);	// 
 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()
--- 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"),
--- 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'
--- 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,
--- 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
--- 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
--- 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,