@@ -102,7 +102,7 @@ static void cmdline_del __ARGS((int from));
102102static void redrawcmdprompt __ARGS ((void ));
103103static void cursorcmd __ARGS ((void ));
104104static int ccheck_abbr __ARGS ((int ));
105- static int nextwild __ARGS ((expand_T * xp , int type , int options ));
105+ static int nextwild __ARGS ((expand_T * xp , int type , int options , int escape ));
106106static void escape_fname __ARGS ((char_u * * pp ));
107107static int showmatches __ARGS ((expand_T * xp , int wildmenu ));
108108static void set_expand_context __ARGS ((expand_T * xp ));
@@ -810,9 +810,11 @@ getcmdline(firstc, count, indent)
810810 did_wild_list = TRUE;
811811 }
812812 if (wim_flags [wim_index ] & WIM_LONGEST )
813- res = nextwild (& xpc , WILD_LONGEST , WILD_NO_BEEP );
813+ res = nextwild (& xpc , WILD_LONGEST , WILD_NO_BEEP ,
814+ firstc != '@' );
814815 else if (wim_flags [wim_index ] & WIM_FULL )
815- res = nextwild (& xpc , WILD_NEXT , WILD_NO_BEEP );
816+ res = nextwild (& xpc , WILD_NEXT , WILD_NO_BEEP ,
817+ firstc != '@' );
816818 else
817819 res = OK ; /* don't insert 'wildchar' now */
818820 }
@@ -823,9 +825,11 @@ getcmdline(firstc, count, indent)
823825 /* if 'wildmode' first contains "longest", get longest
824826 * common part */
825827 if (wim_flags [0 ] & WIM_LONGEST )
826- res = nextwild (& xpc , WILD_LONGEST , WILD_NO_BEEP );
828+ res = nextwild (& xpc , WILD_LONGEST , WILD_NO_BEEP ,
829+ firstc != '@' );
827830 else
828- res = nextwild (& xpc , WILD_EXPAND_KEEP , WILD_NO_BEEP );
831+ res = nextwild (& xpc , WILD_EXPAND_KEEP , WILD_NO_BEEP ,
832+ firstc != '@' );
829833
830834 /* if interrupted while completing, behave like it failed */
831835 if (got_int )
@@ -860,7 +864,8 @@ getcmdline(firstc, count, indent)
860864 int p_wmnu_save = p_wmnu ;
861865 p_wmnu = 0 ;
862866#endif
863- nextwild (& xpc , WILD_PREV , 0 ); /* remove match */
867+ /* remove match */
868+ nextwild (& xpc , WILD_PREV , 0 , firstc != '@' );
864869#ifdef FEAT_WILDMENU
865870 p_wmnu = p_wmnu_save ;
866871#endif
@@ -874,9 +879,11 @@ getcmdline(firstc, count, indent)
874879 redrawcmd ();
875880 did_wild_list = TRUE;
876881 if (wim_flags [wim_index ] & WIM_LONGEST )
877- nextwild (& xpc , WILD_LONGEST , WILD_NO_BEEP );
882+ nextwild (& xpc , WILD_LONGEST , WILD_NO_BEEP ,
883+ firstc != '@' );
878884 else if (wim_flags [wim_index ] & WIM_FULL )
879- nextwild (& xpc , WILD_NEXT , WILD_NO_BEEP );
885+ nextwild (& xpc , WILD_NEXT , WILD_NO_BEEP ,
886+ firstc != '@' );
880887 }
881888 else
882889 vim_beep ();
@@ -899,9 +906,9 @@ getcmdline(firstc, count, indent)
899906 /* <S-Tab> goes to last match, in a clumsy way */
900907 if (c == K_S_TAB && KeyTyped )
901908 {
902- if (nextwild (& xpc , WILD_EXPAND_KEEP , 0 ) == OK
903- && nextwild (& xpc , WILD_PREV , 0 ) == OK
904- && nextwild (& xpc , WILD_PREV , 0 ) == OK )
909+ if (nextwild (& xpc , WILD_EXPAND_KEEP , 0 , firstc != '@' ) == OK
910+ && nextwild (& xpc , WILD_PREV , 0 , firstc != '@' ) == OK
911+ && nextwild (& xpc , WILD_PREV , 0 , firstc != '@' ) == OK )
905912 goto cmdline_changed ;
906913 }
907914
@@ -1418,7 +1425,7 @@ getcmdline(firstc, count, indent)
14181425 goto cmdline_not_changed ;
14191426
14201427 case Ctrl_A : /* all matches */
1421- if (nextwild (& xpc , WILD_ALL , 0 ) == FAIL )
1428+ if (nextwild (& xpc , WILD_ALL , 0 , firstc != '@' ) == FAIL )
14221429 break ;
14231430 goto cmdline_changed ;
14241431
@@ -1454,16 +1461,16 @@ getcmdline(firstc, count, indent)
14541461#endif
14551462
14561463 /* completion: longest common part */
1457- if (nextwild (& xpc , WILD_LONGEST , 0 ) == FAIL )
1464+ if (nextwild (& xpc , WILD_LONGEST , 0 , firstc != '@' ) == FAIL )
14581465 break ;
14591466 goto cmdline_changed ;
14601467
14611468 case Ctrl_N : /* next match */
14621469 case Ctrl_P : /* previous match */
14631470 if (xpc .xp_numfiles > 0 )
14641471 {
1465- if (nextwild (& xpc , (c == Ctrl_P ) ? WILD_PREV : WILD_NEXT , 0 )
1466- == FAIL )
1472+ if (nextwild (& xpc , (c == Ctrl_P ) ? WILD_PREV : WILD_NEXT ,
1473+ 0 , firstc != '@' ) == FAIL )
14671474 break ;
14681475 goto cmdline_changed ;
14691476 }
@@ -3338,10 +3345,11 @@ sort_func_compare(s1, s2)
33383345 * normal character (instead of being expanded). This allows :s/^I^D etc.
33393346 */
33403347 static int
3341- nextwild (xp , type , options )
3348+ nextwild (xp , type , options , escape )
33423349 expand_T * xp ;
33433350 int type ;
33443351 int options ; /* extra options for ExpandOne() */
3352+ int escape ; /* if TRUE, escape the returned matches */
33453353{
33463354 int i , j ;
33473355 char_u * p1 ;
@@ -3390,7 +3398,9 @@ nextwild(xp, type, options)
33903398 else
33913399 {
33923400 int use_options = options |
3393- WILD_HOME_REPLACE |WILD_ADD_SLASH |WILD_SILENT |WILD_ESCAPE ;
3401+ WILD_HOME_REPLACE |WILD_ADD_SLASH |WILD_SILENT ;
3402+ if (escape )
3403+ use_options |= WILD_ESCAPE ;
33943404
33953405 if (p_wic )
33963406 use_options += WILD_ICASE ;
0 commit comments