Karsten Hopp d5fa79
To: vim_dev@googlegroups.com
Karsten Hopp d5fa79
Subject: Patch 7.3.514
Karsten Hopp d5fa79
Fcc: outbox
Karsten Hopp d5fa79
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d5fa79
Mime-Version: 1.0
Karsten Hopp d5fa79
Content-Type: text/plain; charset=UTF-8
Karsten Hopp d5fa79
Content-Transfer-Encoding: 8bit
Karsten Hopp d5fa79
------------
Karsten Hopp d5fa79
Karsten Hopp d5fa79
Patch 7.3.514
Karsten Hopp d5fa79
Problem:    No completion for :history command.
Karsten Hopp d5fa79
Solution:   Add the completion and update the docs. Also fix ":behave"
Karsten Hopp d5fa79
	    completion. (Dominique Pelle)
Karsten Hopp d5fa79
Files:	    runtime/doc/cmdline.txt, runtime/doc/map.txt, src/ex_docmd.c,
Karsten Hopp d5fa79
	    src/ex_getln.c, src/vim.h
Karsten Hopp d5fa79
Karsten Hopp d5fa79
Karsten Hopp d5fa79
*** ../vim-7.3.513/runtime/doc/cmdline.txt	2010-08-15 21:57:17.000000000 +0200
Karsten Hopp d5fa79
--- runtime/doc/cmdline.txt	2012-04-30 18:30:00.000000000 +0200
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 330,341 ****
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
  :his[tory] [{name}] [{first}][, [{last}]]
Karsten Hopp d5fa79
  		List the contents of history {name} which can be:
Karsten Hopp d5fa79
! 		c[md]	 or :	command-line history
Karsten Hopp d5fa79
! 		s[earch] or /	search string history
Karsten Hopp d5fa79
! 		e[xpr]	 or =	expression register history
Karsten Hopp d5fa79
! 		i[nput]	 or @	input line history
Karsten Hopp d5fa79
! 		d[ebug]	 or >	debug command history
Karsten Hopp d5fa79
! 		a[ll]		all of the above
Karsten Hopp d5fa79
  		{not in Vi}
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
  		If the numbers {first} and/or {last} are given, the respective
Karsten Hopp d5fa79
--- 330,341 ----
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
  :his[tory] [{name}] [{first}][, [{last}]]
Karsten Hopp d5fa79
  		List the contents of history {name} which can be:
Karsten Hopp d5fa79
! 		c[md]	 or :		command-line history
Karsten Hopp d5fa79
! 		s[earch] or / or ?	search string history
Karsten Hopp d5fa79
! 		e[xpr]	 or =		expression register history
Karsten Hopp d5fa79
! 		i[nput]	 or @		input line history
Karsten Hopp d5fa79
! 		d[ebug]	 or >		debug command history
Karsten Hopp d5fa79
! 		a[ll]			all of the above
Karsten Hopp d5fa79
  		{not in Vi}
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
  		If the numbers {first} and/or {last} are given, the respective
Karsten Hopp d5fa79
*** ../vim-7.3.513/runtime/doc/map.txt	2011-07-20 16:36:35.000000000 +0200
Karsten Hopp d5fa79
--- runtime/doc/map.txt	2012-04-30 18:30:00.000000000 +0200
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 1202,1207 ****
Karsten Hopp d5fa79
--- 1219,1225 ----
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
  	-complete=augroup	autocmd groups
Karsten Hopp d5fa79
  	-complete=buffer	buffer names
Karsten Hopp d5fa79
+ 	-complete=behave	:behave suboptions
Karsten Hopp d5fa79
  	-complete=color		color schemes
Karsten Hopp d5fa79
  	-complete=command	Ex command (and arguments)
Karsten Hopp d5fa79
  	-complete=compiler	compilers
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 1216,1221 ****
Karsten Hopp d5fa79
--- 1234,1240 ----
Karsten Hopp d5fa79
  	-complete=function	function name
Karsten Hopp d5fa79
  	-complete=help		help subjects
Karsten Hopp d5fa79
  	-complete=highlight	highlight groups
Karsten Hopp d5fa79
+ 	-complete=history	:history suboptions
Karsten Hopp d5fa79
  	-complete=locale	locale names (as output of locale -a)
Karsten Hopp d5fa79
  	-complete=mapping	mapping name
Karsten Hopp d5fa79
  	-complete=menu		menus
Karsten Hopp d5fa79
*** ../vim-7.3.513/src/ex_docmd.c	2012-02-12 20:13:55.000000000 +0100
Karsten Hopp d5fa79
--- src/ex_docmd.c	2012-04-30 18:33:27.000000000 +0200
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 3920,3927 ****
Karsten Hopp d5fa79
--- 3920,3935 ----
Karsten Hopp d5fa79
  #endif
Karsten Hopp d5fa79
  	case CMD_behave:
Karsten Hopp d5fa79
  	    xp->xp_context = EXPAND_BEHAVE;
Karsten Hopp d5fa79
+ 	    xp->xp_pattern = arg;
Karsten Hopp d5fa79
  	    break;
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
+ #if defined(FEAT_CMDHIST)
Karsten Hopp d5fa79
+ 	case CMD_history:
Karsten Hopp d5fa79
+ 	    xp->xp_context = EXPAND_HISTORY;
Karsten Hopp d5fa79
+ 	    xp->xp_pattern = arg;
Karsten Hopp d5fa79
+ 	    break;
Karsten Hopp d5fa79
+ #endif
Karsten Hopp d5fa79
+ 
Karsten Hopp d5fa79
  #endif /* FEAT_CMDL_COMPL */
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
  	default:
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 5329,5334 ****
Karsten Hopp d5fa79
--- 5337,5343 ----
Karsten Hopp d5fa79
  } command_complete[] =
Karsten Hopp d5fa79
  {
Karsten Hopp d5fa79
      {EXPAND_AUGROUP, "augroup"},
Karsten Hopp d5fa79
+     {EXPAND_BEHAVE, "behave"},
Karsten Hopp d5fa79
      {EXPAND_BUFFERS, "buffer"},
Karsten Hopp d5fa79
      {EXPAND_COLORS, "color"},
Karsten Hopp d5fa79
      {EXPAND_COMMANDS, "command"},
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 5350,5357 ****
Karsten Hopp d5fa79
      {EXPAND_FUNCTIONS, "function"},
Karsten Hopp d5fa79
      {EXPAND_HELP, "help"},
Karsten Hopp d5fa79
      {EXPAND_HIGHLIGHT, "highlight"},
Karsten Hopp d5fa79
  #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
Karsten Hopp d5fa79
!         && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
Karsten Hopp d5fa79
      {EXPAND_LOCALES, "locale"},
Karsten Hopp d5fa79
  #endif
Karsten Hopp d5fa79
      {EXPAND_MAPPINGS, "mapping"},
Karsten Hopp d5fa79
--- 5359,5369 ----
Karsten Hopp d5fa79
      {EXPAND_FUNCTIONS, "function"},
Karsten Hopp d5fa79
      {EXPAND_HELP, "help"},
Karsten Hopp d5fa79
      {EXPAND_HIGHLIGHT, "highlight"},
Karsten Hopp d5fa79
+ #if defined(FEAT_CMDHIST)
Karsten Hopp d5fa79
+     {EXPAND_HISTORY, "history"},
Karsten Hopp d5fa79
+ #endif
Karsten Hopp d5fa79
  #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
Karsten Hopp d5fa79
! 	&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
Karsten Hopp d5fa79
      {EXPAND_LOCALES, "locale"},
Karsten Hopp d5fa79
  #endif
Karsten Hopp d5fa79
      {EXPAND_MAPPINGS, "mapping"},
Karsten Hopp d5fa79
*** ../vim-7.3.513/src/ex_getln.c	2012-03-07 19:16:49.000000000 +0100
Karsten Hopp d5fa79
--- src/ex_getln.c	2012-04-30 18:36:04.000000000 +0200
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 25,31 ****
Karsten Hopp d5fa79
      int		cmdlen;		/* number of chars in command line */
Karsten Hopp d5fa79
      int		cmdpos;		/* current cursor position */
Karsten Hopp d5fa79
      int		cmdspos;	/* cursor column on screen */
Karsten Hopp d5fa79
!     int		cmdfirstc;	/* ':', '/', '?', '=' or NUL */
Karsten Hopp d5fa79
      int		cmdindent;	/* number of spaces before cmdline */
Karsten Hopp d5fa79
      char_u	*cmdprompt;	/* message in front of cmdline */
Karsten Hopp d5fa79
      int		cmdattr;	/* attributes for prompt */
Karsten Hopp d5fa79
--- 25,31 ----
Karsten Hopp d5fa79
      int		cmdlen;		/* number of chars in command line */
Karsten Hopp d5fa79
      int		cmdpos;		/* current cursor position */
Karsten Hopp d5fa79
      int		cmdspos;	/* cursor column on screen */
Karsten Hopp d5fa79
!     int		cmdfirstc;	/* ':', '/', '?', '=', '>' or NUL */
Karsten Hopp d5fa79
      int		cmdindent;	/* number of spaces before cmdline */
Karsten Hopp d5fa79
      char_u	*cmdprompt;	/* message in front of cmdline */
Karsten Hopp d5fa79
      int		cmdattr;	/* attributes for prompt */
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 111,116 ****
Karsten Hopp d5fa79
--- 111,119 ----
Karsten Hopp d5fa79
  #ifdef FEAT_CMDL_COMPL
Karsten Hopp d5fa79
  static int	expand_shellcmd __ARGS((char_u *filepat, int *num_file, char_u ***file, int flagsarg));
Karsten Hopp d5fa79
  static int	ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname[]));
Karsten Hopp d5fa79
+ # ifdef FEAT_CMDHIST
Karsten Hopp d5fa79
+ static char_u	*get_history_arg __ARGS((expand_T *xp, int idx));
Karsten Hopp d5fa79
+ # endif
Karsten Hopp d5fa79
  # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
Karsten Hopp d5fa79
  static int	ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
Karsten Hopp d5fa79
  static int	ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file));
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 4628,4633 ****
Karsten Hopp d5fa79
--- 4631,4639 ----
Karsten Hopp d5fa79
  	{
Karsten Hopp d5fa79
  	    {EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
Karsten Hopp d5fa79
  	    {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
Karsten Hopp d5fa79
+ #ifdef FEAT_CMDHIST
Karsten Hopp d5fa79
+ 	    {EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
Karsten Hopp d5fa79
+ #endif
Karsten Hopp d5fa79
  #ifdef FEAT_USR_CMDS
Karsten Hopp d5fa79
  	    {EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
Karsten Hopp d5fa79
  	    {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 5245,5250 ****
Karsten Hopp d5fa79
--- 5251,5284 ----
Karsten Hopp d5fa79
      NULL
Karsten Hopp d5fa79
  };
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
+ #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
Karsten Hopp d5fa79
+ /*
Karsten Hopp d5fa79
+  * Function given to ExpandGeneric() to obtain the possible first
Karsten Hopp d5fa79
+  * arguments of the ":history command.
Karsten Hopp d5fa79
+  */
Karsten Hopp d5fa79
+     static char_u *
Karsten Hopp d5fa79
+ get_history_arg(xp, idx)
Karsten Hopp d5fa79
+     expand_T	*xp UNUSED;
Karsten Hopp d5fa79
+     int		idx;
Karsten Hopp d5fa79
+ {
Karsten Hopp d5fa79
+     static char_u compl[2] = { NUL, NUL };
Karsten Hopp d5fa79
+     char *short_names = ":=@>?/";
Karsten Hopp d5fa79
+     int short_names_count = STRLEN(short_names);
Karsten Hopp d5fa79
+     int history_name_count = sizeof(history_names) / sizeof(char *) - 1;
Karsten Hopp d5fa79
+ 
Karsten Hopp d5fa79
+     if (idx < short_names_count)
Karsten Hopp d5fa79
+     {
Karsten Hopp d5fa79
+ 	compl[0] = (char_u)short_names[idx];
Karsten Hopp d5fa79
+ 	return compl;
Karsten Hopp d5fa79
+     }
Karsten Hopp d5fa79
+     if (idx < short_names_count + history_name_count)
Karsten Hopp d5fa79
+ 	return (char_u *)history_names[idx - short_names_count];
Karsten Hopp d5fa79
+     if (idx == short_names_count + history_name_count)
Karsten Hopp d5fa79
+ 	return (char_u *)"all";
Karsten Hopp d5fa79
+     return NULL;
Karsten Hopp d5fa79
+ }
Karsten Hopp d5fa79
+ #endif
Karsten Hopp d5fa79
+ 
Karsten Hopp d5fa79
  /*
Karsten Hopp d5fa79
   * init_history() - Initialize the command line history.
Karsten Hopp d5fa79
   * Also used to re-allocate the history when the size changes.
Karsten Hopp d5fa79
*** ../vim-7.3.513/src/vim.h	2012-03-23 16:25:13.000000000 +0100
Karsten Hopp d5fa79
--- src/vim.h	2012-04-30 18:30:00.000000000 +0200
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 781,786 ****
Karsten Hopp d5fa79
--- 781,787 ----
Karsten Hopp d5fa79
  #define EXPAND_FILES_IN_PATH	38
Karsten Hopp d5fa79
  #define EXPAND_OWNSYNTAX	39
Karsten Hopp d5fa79
  #define EXPAND_LOCALES		40
Karsten Hopp d5fa79
+ #define EXPAND_HISTORY		41
Karsten Hopp d5fa79
  
Karsten Hopp d5fa79
  /* Values for exmode_active (0 is no exmode) */
Karsten Hopp d5fa79
  #define EXMODE_NORMAL		1
Karsten Hopp d5fa79
*** ../vim-7.3.513/src/version.c	2012-04-30 18:18:43.000000000 +0200
Karsten Hopp d5fa79
--- src/version.c	2012-04-30 18:36:19.000000000 +0200
Karsten Hopp d5fa79
***************
Karsten Hopp d5fa79
*** 716,717 ****
Karsten Hopp d5fa79
--- 716,719 ----
Karsten Hopp d5fa79
  {   /* Add new patch number below this line */
Karsten Hopp d5fa79
+ /**/
Karsten Hopp d5fa79
+     514,
Karsten Hopp d5fa79
  /**/
Karsten Hopp d5fa79
Karsten Hopp d5fa79
-- 
Karsten Hopp d5fa79
You can be stopped by the police for biking over 65 miles per hour.
Karsten Hopp d5fa79
You are not allowed to walk across a street on your hands.
Karsten Hopp d5fa79
		[real standing laws in Connecticut, United States of America]
Karsten Hopp d5fa79
Karsten Hopp d5fa79
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d5fa79
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d5fa79
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp d5fa79
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///