To: vim-dev@vim.org
Subject: Patch 6.0.157
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.0.157
Problem:    When defining a user command with "-complete=dir" files will also
	    be expanded.  Also, "-complete=mapping" doesn't appear to work.
	    (Michael Naumann)
Solution:   Use the expansion flags defined with the user command.
	    Handle expanding mappings specifically.
Files:	    src/ex_docmd.c


*** ../vim60.156/src/ex_docmd.c	Tue Jan 15 14:34:37 2002
--- src/ex_docmd.c	Wed Jan 30 16:48:00 2002
***************
*** 2770,2788 ****
  #ifdef FEAT_USR_CMDS
  	case CMD_USER:
  	case CMD_USER_BUF:
! 	    /* XFILE: file names are handled above */
! 	    if (compl != EXPAND_NOTHING && !(argt & XFILE))
  	    {
  # ifdef FEAT_MENU
! 		if (compl == EXPAND_MENUS)
! 		    return set_context_in_menu_cmd(xp, cmd, arg, forceit);
  # endif
! 		if (compl == EXPAND_COMMANDS)
! 		    return arg;
! 		while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL)
! 		    arg = xp->xp_pattern + 1;
  		xp->xp_context = compl;
- 		xp->xp_pattern = arg;
  	    }
  	    break;
  #endif
--- 2770,2794 ----
  #ifdef FEAT_USR_CMDS
  	case CMD_USER:
  	case CMD_USER_BUF:
! 	    if (compl != EXPAND_NOTHING)
  	    {
+ 		/* XFILE: file names are handled above */
+ 		if (!(argt & XFILE))
+ 		{
  # ifdef FEAT_MENU
! 		    if (compl == EXPAND_MENUS)
! 			return set_context_in_menu_cmd(xp, cmd, arg, forceit);
  # endif
! 		    if (compl == EXPAND_COMMANDS)
! 			return arg;
! 		    if (compl == EXPAND_MAPPINGS)
! 			return set_context_in_map_cmd(xp, (char_u *)"map",
! 					 arg, forceit, FALSE, FALSE, CMD_map);
! 		    while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL)
! 			arg = xp->xp_pattern + 1;
! 		    xp->xp_pattern = arg;
! 		}
  		xp->xp_context = compl;
  	    }
  	    break;
  #endif
*** ../vim60.156/src/version.c	Wed Jan 30 16:50:08 2002
--- src/version.c	Wed Jan 30 16:49:36 2002
***************
*** 608,609 ****
--- 608,611 ----
  {   /* Add new patch number below this line */
+ /**/
+     157,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
94. Now admit it... How many of you have made "modem noises" into
    the phone just to see if it was possible? :-)

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
(((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///