]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.514 v7.3.514
authorBram Moolenaar <Bram@vim.org>
Mon, 30 Apr 2012 16:48:53 +0000 (18:48 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 30 Apr 2012 16:48:53 +0000 (18:48 +0200)
Problem:    No completion for :history command.
Solution:   Add the completion and update the docs. Also fix ":behave"
            completion. (Dominique Pelle)

runtime/doc/cmdline.txt
runtime/doc/map.txt
src/ex_docmd.c
src/ex_getln.c
src/version.c
src/vim.h

index 6aec69ec9322dff7cf6b17ade023143ac6c02ad8..a66826512333a640838b6cc6a52c739059c77079 100644 (file)
@@ -330,12 +330,12 @@ terminals)
 
 :his[tory] [{name}] [{first}][, [{last}]]
                List the contents of history {name} which can be:
-               c[md]    or :   command-line history
-               s[earch] or /   search string history
-               e[xpr]   or =   expression register history
-               i[nput]  or @   input line history
-               d[ebug]  or >   debug command history
-               a[ll]           all of the above
+               c[md]    or :           command-line history
+               s[earch] or / or ?      search string history
+               e[xpr]   or =           expression register history
+               i[nput]  or @           input line history
+               d[ebug]  or >           debug command history
+               a[ll]                   all of the above
                {not in Vi}
 
                If the numbers {first} and/or {last} are given, the respective
index 0c46d454268bce8de160aef3dee6c8c6f5d78439..b4b77deaa29ea7b0205b278c03a8edf8b3cce991 100644 (file)
@@ -1219,6 +1219,7 @@ completion can be enabled:
 
        -complete=augroup       autocmd groups
        -complete=buffer        buffer names
+       -complete=behave        :behave suboptions
        -complete=color         color schemes
        -complete=command       Ex command (and arguments)
        -complete=compiler      compilers
@@ -1233,6 +1234,7 @@ completion can be enabled:
        -complete=function      function name
        -complete=help          help subjects
        -complete=highlight     highlight groups
+       -complete=history       :history suboptions
        -complete=locale        locale names (as output of locale -a)
        -complete=mapping       mapping name
        -complete=menu          menus
index 133fa7d6883f720416196061efd864e7318a6161..44b61df82daefb9f890a82968cebb1fbf2087e35 100644 (file)
@@ -3920,8 +3920,16 @@ set_one_cmd_context(xp, buff)
 #endif
        case CMD_behave:
            xp->xp_context = EXPAND_BEHAVE;
+           xp->xp_pattern = arg;
            break;
 
+#if defined(FEAT_CMDHIST)
+       case CMD_history:
+           xp->xp_context = EXPAND_HISTORY;
+           xp->xp_pattern = arg;
+           break;
+#endif
+
 #endif /* FEAT_CMDL_COMPL */
 
        default:
@@ -5329,6 +5337,7 @@ static struct
 } command_complete[] =
 {
     {EXPAND_AUGROUP, "augroup"},
+    {EXPAND_BEHAVE, "behave"},
     {EXPAND_BUFFERS, "buffer"},
     {EXPAND_COLORS, "color"},
     {EXPAND_COMMANDS, "command"},
@@ -5350,8 +5359,11 @@ static struct
     {EXPAND_FUNCTIONS, "function"},
     {EXPAND_HELP, "help"},
     {EXPAND_HIGHLIGHT, "highlight"},
+#if defined(FEAT_CMDHIST)
+    {EXPAND_HISTORY, "history"},
+#endif
 #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
-        && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
+       && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
     {EXPAND_LOCALES, "locale"},
 #endif
     {EXPAND_MAPPINGS, "mapping"},
index 38775af605b1361d63962f10d3f53eb650b7f56c..3d0c26f05e55e089c75a632f008ba9b7a0bbfcab 100644 (file)
@@ -25,7 +25,7 @@ struct cmdline_info
     int                cmdlen;         /* number of chars in command line */
     int                cmdpos;         /* current cursor position */
     int                cmdspos;        /* cursor column on screen */
-    int                cmdfirstc;      /* ':', '/', '?', '=' or NUL */
+    int                cmdfirstc;      /* ':', '/', '?', '=', '>' or NUL */
     int                cmdindent;      /* number of spaces before cmdline */
     char_u     *cmdprompt;     /* message in front of cmdline */
     int                cmdattr;        /* attributes for prompt */
@@ -111,6 +111,9 @@ static int  expand_showtail __ARGS((expand_T *xp));
 #ifdef FEAT_CMDL_COMPL
 static int     expand_shellcmd __ARGS((char_u *filepat, int *num_file, char_u ***file, int flagsarg));
 static int     ExpandRTDir __ARGS((char_u *pat, int *num_file, char_u ***file, char *dirname[]));
+# ifdef FEAT_CMDHIST
+static char_u  *get_history_arg __ARGS((expand_T *xp, int idx));
+# endif
 # if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL)
 static int     ExpandUserDefined __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
 static int     ExpandUserList __ARGS((expand_T *xp, int *num_file, char_u ***file));
@@ -4628,6 +4631,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
        {
            {EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
            {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
+#ifdef FEAT_CMDHIST
+           {EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
+#endif
 #ifdef FEAT_USR_CMDS
            {EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
            {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
@@ -5245,6 +5251,34 @@ static char *(history_names[]) =
     NULL
 };
 
+#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
+/*
+ * Function given to ExpandGeneric() to obtain the possible first
+ * arguments of the ":history command.
+ */
+    static char_u *
+get_history_arg(xp, idx)
+    expand_T   *xp UNUSED;
+    int                idx;
+{
+    static char_u compl[2] = { NUL, NUL };
+    char *short_names = ":=@>?/";
+    int short_names_count = STRLEN(short_names);
+    int history_name_count = sizeof(history_names) / sizeof(char *) - 1;
+
+    if (idx < short_names_count)
+    {
+       compl[0] = (char_u)short_names[idx];
+       return compl;
+    }
+    if (idx < short_names_count + history_name_count)
+       return (char_u *)history_names[idx - short_names_count];
+    if (idx == short_names_count + history_name_count)
+       return (char_u *)"all";
+    return NULL;
+}
+#endif
+
 /*
  * init_history() - Initialize the command line history.
  * Also used to re-allocate the history when the size changes.
index de24ff4bd67b7bbb4e6277aa221b1af9e25ccc0f..e5a7fd94a0ac1ab252f54ee96e724a5a89c60d8e 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    514,
 /**/
     513,
 /**/
index b67702b5815637b85b08a18e0c4aacd6c802dbba..5cd5e3026f3e679e63ddaa2f9efbf8f3af91253d 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -781,6 +781,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
 #define EXPAND_FILES_IN_PATH   38
 #define EXPAND_OWNSYNTAX       39
 #define EXPAND_LOCALES         40
+#define EXPAND_HISTORY         41
 
 /* Values for exmode_active (0 is no exmode) */
 #define EXMODE_NORMAL          1