Karsten Hopp ad2d55
To: vim-dev@vim.org
Karsten Hopp ad2d55
Subject: Patch 7.2.381
Karsten Hopp ad2d55
Fcc: outbox
Karsten Hopp ad2d55
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ad2d55
Mime-Version: 1.0
Karsten Hopp ad2d55
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ad2d55
Content-Transfer-Encoding: 8bit
Karsten Hopp ad2d55
------------
Karsten Hopp ad2d55
Karsten Hopp ad2d55
Patch 7.2.381
Karsten Hopp ad2d55
Problem:    No completion for :behave.
Karsten Hopp ad2d55
Solution:   Add :behave completion.  Minor related fixes. (Dominique Pelle)
Karsten Hopp ad2d55
Files:	    src/ex_docmd.c, src/ex_getln.c, src/proto/ex_docmd.pro, src/vim.h
Karsten Hopp ad2d55
Karsten Hopp ad2d55
Karsten Hopp ad2d55
*** ../vim-7.2.380/src/ex_docmd.c	2010-02-03 15:14:15.000000000 +0100
Karsten Hopp ad2d55
--- src/ex_docmd.c	2010-03-02 15:55:05.000000000 +0100
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 26,35 ****
Karsten Hopp ad2d55
      long_u	uc_argt;	/* The argument type */
Karsten Hopp ad2d55
      char_u	*uc_rep;	/* The command's replacement string */
Karsten Hopp ad2d55
      long	uc_def;		/* The default value for a range/count */
Karsten Hopp ad2d55
-     scid_T	uc_scriptID;	/* SID where the command was defined */
Karsten Hopp ad2d55
      int		uc_compl;	/* completion type */
Karsten Hopp ad2d55
! # if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
Karsten Hopp ad2d55
      char_u	*uc_compl_arg;	/* completion argument if any */
Karsten Hopp ad2d55
  # endif
Karsten Hopp ad2d55
  } ucmd_T;
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
--- 26,37 ----
Karsten Hopp ad2d55
      long_u	uc_argt;	/* The argument type */
Karsten Hopp ad2d55
      char_u	*uc_rep;	/* The command's replacement string */
Karsten Hopp ad2d55
      long	uc_def;		/* The default value for a range/count */
Karsten Hopp ad2d55
      int		uc_compl;	/* completion type */
Karsten Hopp ad2d55
! # ifdef FEAT_EVAL
Karsten Hopp ad2d55
!     scid_T	uc_scriptID;	/* SID where the command was defined */
Karsten Hopp ad2d55
! #  ifdef FEAT_CMDL_COMPL
Karsten Hopp ad2d55
      char_u	*uc_compl_arg;	/* completion argument if any */
Karsten Hopp ad2d55
+ #  endif
Karsten Hopp ad2d55
  # endif
Karsten Hopp ad2d55
  } ucmd_T;
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 3156,3172 ****
Karsten Hopp ad2d55
  	    return NULL;
Karsten Hopp ad2d55
  	}
Karsten Hopp ad2d55
  	for (ea.cmdidx = (cmdidx_T)0; (int)ea.cmdidx < (int)CMD_SIZE;
Karsten Hopp ad2d55
! 					 ea.cmdidx = (cmdidx_T)((int)ea.cmdidx + 1))
Karsten Hopp ad2d55
! 	    if (STRNCMP(cmdnames[(int)ea.cmdidx].cmd_name, cmd, (size_t)len) == 0)
Karsten Hopp ad2d55
  		break;
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  #ifdef FEAT_USR_CMDS
Karsten Hopp ad2d55
  	if (cmd[0] >= 'A' && cmd[0] <= 'Z')
Karsten Hopp ad2d55
- 	{
Karsten Hopp ad2d55
  	    while (ASCII_ISALNUM(*p) || *p == '*')	/* Allow * wild card */
Karsten Hopp ad2d55
  		++p;
Karsten Hopp ad2d55
- 	    len = (int)(p - cmd);
Karsten Hopp ad2d55
- 	}
Karsten Hopp ad2d55
  #endif
Karsten Hopp ad2d55
      }
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
--- 3158,3172 ----
Karsten Hopp ad2d55
  	    return NULL;
Karsten Hopp ad2d55
  	}
Karsten Hopp ad2d55
  	for (ea.cmdidx = (cmdidx_T)0; (int)ea.cmdidx < (int)CMD_SIZE;
Karsten Hopp ad2d55
! 				   ea.cmdidx = (cmdidx_T)((int)ea.cmdidx + 1))
Karsten Hopp ad2d55
! 	    if (STRNCMP(cmdnames[(int)ea.cmdidx].cmd_name, cmd,
Karsten Hopp ad2d55
! 							    (size_t)len) == 0)
Karsten Hopp ad2d55
  		break;
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  #ifdef FEAT_USR_CMDS
Karsten Hopp ad2d55
  	if (cmd[0] >= 'A' && cmd[0] <= 'Z')
Karsten Hopp ad2d55
  	    while (ASCII_ISALNUM(*p) || *p == '*')	/* Allow * wild card */
Karsten Hopp ad2d55
  		++p;
Karsten Hopp ad2d55
  #endif
Karsten Hopp ad2d55
      }
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 3809,3814 ****
Karsten Hopp ad2d55
--- 3809,3817 ----
Karsten Hopp ad2d55
  	    set_context_in_profile_cmd(xp, arg);
Karsten Hopp ad2d55
  	    break;
Karsten Hopp ad2d55
  #endif
Karsten Hopp ad2d55
+ 	case CMD_behave:
Karsten Hopp ad2d55
+ 	    xp->xp_context = EXPAND_BEHAVE;
Karsten Hopp ad2d55
+ 	    break;
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  #endif /* FEAT_CMDL_COMPL */
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 10847,10852 ****
Karsten Hopp ad2d55
--- 10850,10873 ----
Karsten Hopp ad2d55
  	EMSG2(_(e_invarg2), eap->arg);
Karsten Hopp ad2d55
  }
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
+ #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
Karsten Hopp ad2d55
+ /*
Karsten Hopp ad2d55
+  * Function given to ExpandGeneric() to obtain the possible arguments of the
Karsten Hopp ad2d55
+  * ":behave {mswin,xterm}" command.
Karsten Hopp ad2d55
+  */
Karsten Hopp ad2d55
+     char_u *
Karsten Hopp ad2d55
+ get_behave_arg(xp, idx)
Karsten Hopp ad2d55
+     expand_T	*xp UNUSED;
Karsten Hopp ad2d55
+     int		idx;
Karsten Hopp ad2d55
+ {
Karsten Hopp ad2d55
+     if (idx == 0)
Karsten Hopp ad2d55
+ 	return (char_u *)"mswin";
Karsten Hopp ad2d55
+     if (idx == 1)
Karsten Hopp ad2d55
+ 	return (char_u *)"xterm";
Karsten Hopp ad2d55
+     return NULL;
Karsten Hopp ad2d55
+ }
Karsten Hopp ad2d55
+ #endif
Karsten Hopp ad2d55
+ 
Karsten Hopp ad2d55
  #ifdef FEAT_AUTOCMD
Karsten Hopp ad2d55
  static int filetype_detect = FALSE;
Karsten Hopp ad2d55
  static int filetype_plugin = FALSE;
Karsten Hopp ad2d55
*** ../vim-7.2.380/src/ex_getln.c	2010-02-03 15:14:15.000000000 +0100
Karsten Hopp ad2d55
--- src/ex_getln.c	2010-03-02 15:28:13.000000000 +0100
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 4492,4497 ****
Karsten Hopp ad2d55
--- 4492,4498 ----
Karsten Hopp ad2d55
  	} tab[] =
Karsten Hopp ad2d55
  	{
Karsten Hopp ad2d55
  	    {EXPAND_COMMANDS, get_command_name, FALSE},
Karsten Hopp ad2d55
+ 	    {EXPAND_BEHAVE, get_behave_arg, TRUE},
Karsten Hopp ad2d55
  #ifdef FEAT_USR_CMDS
Karsten Hopp ad2d55
  	    {EXPAND_USER_COMMANDS, get_user_commands, FALSE},
Karsten Hopp ad2d55
  	    {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE},
Karsten Hopp ad2d55
*** ../vim-7.2.380/src/proto/ex_docmd.pro	2008-07-04 11:43:13.000000000 +0200
Karsten Hopp ad2d55
--- src/proto/ex_docmd.pro	2010-03-02 15:37:37.000000000 +0100
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 52,55 ****
Karsten Hopp ad2d55
--- 52,56 ----
Karsten Hopp ad2d55
  int put_eol __ARGS((FILE *fd));
Karsten Hopp ad2d55
  int put_line __ARGS((FILE *fd, char *s));
Karsten Hopp ad2d55
  void dialog_msg __ARGS((char_u *buff, char *format, char_u *fname));
Karsten Hopp ad2d55
+ char_u *get_behave_arg __ARGS((expand_T *xp, int idx));
Karsten Hopp ad2d55
  /* vim: set ft=c : */
Karsten Hopp ad2d55
*** ../vim-7.2.380/src/vim.h	2010-02-24 14:46:58.000000000 +0100
Karsten Hopp ad2d55
--- src/vim.h	2010-03-02 15:30:13.000000000 +0100
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 595,601 ****
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  /*
Karsten Hopp ad2d55
   * Terminal highlighting attribute bits.
Karsten Hopp ad2d55
!  * Attibutes above HL_ALL are used for syntax highlighting.
Karsten Hopp ad2d55
   */
Karsten Hopp ad2d55
  #define HL_NORMAL		0x00
Karsten Hopp ad2d55
  #define HL_INVERSE		0x01
Karsten Hopp ad2d55
--- 595,601 ----
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  /*
Karsten Hopp ad2d55
   * Terminal highlighting attribute bits.
Karsten Hopp ad2d55
!  * Attributes above HL_ALL are used for syntax highlighting.
Karsten Hopp ad2d55
   */
Karsten Hopp ad2d55
  #define HL_NORMAL		0x00
Karsten Hopp ad2d55
  #define HL_INVERSE		0x01
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 721,726 ****
Karsten Hopp ad2d55
--- 721,727 ----
Karsten Hopp ad2d55
  #define EXPAND_CSCOPE		33
Karsten Hopp ad2d55
  #define EXPAND_SIGN		34
Karsten Hopp ad2d55
  #define EXPAND_PROFILE		35
Karsten Hopp ad2d55
+ #define EXPAND_BEHAVE		36
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  /* Values for exmode_active (0 is no exmode) */
Karsten Hopp ad2d55
  #define EXMODE_NORMAL		1
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 1262,1268 ****
Karsten Hopp ad2d55
  } hlf_T;
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  /* The HL_FLAGS must be in the same order as the HLF_ enums!
Karsten Hopp ad2d55
!  * When chainging this also adjust the default for 'highlight'. */
Karsten Hopp ad2d55
  #define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \
Karsten Hopp ad2d55
  		  'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
Karsten Hopp ad2d55
  		  'f', 'F', 'A', 'C', 'D', 'T', '>', \
Karsten Hopp ad2d55
--- 1263,1269 ----
Karsten Hopp ad2d55
  } hlf_T;
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
  /* The HL_FLAGS must be in the same order as the HLF_ enums!
Karsten Hopp ad2d55
!  * When changing this also adjust the default for 'highlight'. */
Karsten Hopp ad2d55
  #define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \
Karsten Hopp ad2d55
  		  'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
Karsten Hopp ad2d55
  		  'f', 'F', 'A', 'C', 'D', 'T', '>', \
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 1430,1436 ****
Karsten Hopp ad2d55
  #ifdef FEAT_MBYTE
Karsten Hopp ad2d55
  /* We need to call mb_stricmp() even when we aren't dealing with a multi-byte
Karsten Hopp ad2d55
   * encoding because mb_stricmp() takes care of all ascii and non-ascii
Karsten Hopp ad2d55
!  * encodings, including characters with umluats in latin1, etc., while
Karsten Hopp ad2d55
   * STRICMP() only handles the system locale version, which often does not
Karsten Hopp ad2d55
   * handle non-ascii properly. */
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
--- 1431,1437 ----
Karsten Hopp ad2d55
  #ifdef FEAT_MBYTE
Karsten Hopp ad2d55
  /* We need to call mb_stricmp() even when we aren't dealing with a multi-byte
Karsten Hopp ad2d55
   * encoding because mb_stricmp() takes care of all ascii and non-ascii
Karsten Hopp ad2d55
!  * encodings, including characters with umlauts in latin1, etc., while
Karsten Hopp ad2d55
   * STRICMP() only handles the system locale version, which often does not
Karsten Hopp ad2d55
   * handle non-ascii properly. */
Karsten Hopp ad2d55
  
Karsten Hopp ad2d55
*** ../vim-7.2.380/src/version.c	2010-03-02 15:14:22.000000000 +0100
Karsten Hopp ad2d55
--- src/version.c	2010-03-02 15:51:24.000000000 +0100
Karsten Hopp ad2d55
***************
Karsten Hopp ad2d55
*** 683,684 ****
Karsten Hopp ad2d55
--- 683,686 ----
Karsten Hopp ad2d55
  {   /* Add new patch number below this line */
Karsten Hopp ad2d55
+ /**/
Karsten Hopp ad2d55
+     381,
Karsten Hopp ad2d55
  /**/
Karsten Hopp ad2d55
Karsten Hopp ad2d55
-- 
Karsten Hopp ad2d55
I'd like to meet the man who invented sex and see what he's working on now.
Karsten Hopp ad2d55
Karsten Hopp ad2d55
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ad2d55
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ad2d55
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp ad2d55
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///