diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-10-15 15:39:39 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-10-15 15:39:39 +0200 |
commit | 9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8 (patch) | |
tree | d0b3d306fa30c4ad65d2f5e266488dee43644167 /src | |
parent | a6c27ee6db2c328e0ab0e6d143e2a295a0bb9c9a (diff) | |
download | vim-9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8.zip |
patch 8.0.0034
Problem: No completion for ":messages".
Solution: Complete "clear" argument. (Hirohito Higashi)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_docmd.c | 18 | ||||
-rw-r--r-- | src/ex_getln.c | 1 | ||||
-rw-r--r-- | src/proto/ex_docmd.pro | 1 | ||||
-rw-r--r-- | src/testdir/test_cmdline.vim | 5 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 1 |
6 files changed, 28 insertions, 0 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index ac7beb7c5..6802b8b3d 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4281,6 +4281,11 @@ set_one_cmd_context( xp->xp_pattern = arg; break; + case CMD_messages: + xp->xp_context = EXPAND_MESSAGES; + xp->xp_pattern = arg; + break; + #if defined(FEAT_CMDHIST) case CMD_history: xp->xp_context = EXPAND_HISTORY; @@ -5893,6 +5898,7 @@ static struct #endif {EXPAND_MAPPINGS, "mapping"}, {EXPAND_MENUS, "menu"}, + {EXPAND_MESSAGES, "messages"}, {EXPAND_OWNSYNTAX, "syntax"}, #if defined(FEAT_PROFILE) {EXPAND_SYNTIME, "syntime"}, @@ -11901,6 +11907,18 @@ get_behave_arg(expand_T *xp UNUSED, int idx) return (char_u *)"xterm"; return NULL; } + +/* + * Function given to ExpandGeneric() to obtain the possible arguments of the + * ":messages {clear}" command. + */ + char_u * +get_messages_arg(expand_T *xp UNUSED, int idx) +{ + if (idx == 0) + return (char_u *)"clear"; + return NULL; +} #endif #ifdef FEAT_AUTOCMD diff --git a/src/ex_getln.c b/src/ex_getln.c index 25a12bed3..5d098cca3 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4832,6 +4832,7 @@ ExpandFromContext( { {EXPAND_COMMANDS, get_command_name, FALSE, TRUE}, {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE}, + {EXPAND_MESSAGES, get_messages_arg, TRUE, TRUE}, #ifdef FEAT_CMDHIST {EXPAND_HISTORY, get_history_arg, TRUE, TRUE}, #endif diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro index b92ce80d1..11a3f71ac 100644 --- a/src/proto/ex_docmd.pro +++ b/src/proto/ex_docmd.pro @@ -61,4 +61,5 @@ int put_eol(FILE *fd); int put_line(FILE *fd, char *s); void dialog_msg(char_u *buff, char *format, char_u *fname); char_u *get_behave_arg(expand_T *xp, int idx); +char_u *get_messages_arg(expand_T *xp, int idx); /* vim: set ft=c : */ diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 4bacf5721..3718087eb 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -129,6 +129,11 @@ func Test_getcompletion() let l = getcompletion('dark', 'highlight') call assert_equal([], l) + let l = getcompletion('', 'messages') + call assert_true(index(l, 'clear') >= 0) + let l = getcompletion('not', 'messages') + call assert_equal([], l) + if has('cscope') let l = getcompletion('', 'cscope') let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show'] diff --git a/src/version.c b/src/version.c index b2066e4e8..e803bae45 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 34, +/**/ 33, /**/ 32, @@ -793,6 +793,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EXPAND_SYNTIME 43 #define EXPAND_USER_ADDR_TYPE 44 #define EXPAND_PACKADD 45 +#define EXPAND_MESSAGES 46 /* Values for exmode_active (0 is no exmode) */ #define EXMODE_NORMAL 1 |