Mercurial > vim
changeset 10275:6d8b2da002e9 v8.0.0034
commit https://github.com/vim/vim/commit/9e507ca8a3e1535e62de4bd86374b0fcd18ef5b8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 15 15:39:39 2016 +0200
patch 8.0.0034
Problem: No completion for ":messages".
Solution: Complete "clear" argument. (Hirohito Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 15 Oct 2016 15:45:05 +0200 |
parents | 6a11953079ac |
children | ac8a45a5cb0c |
files | runtime/doc/eval.txt runtime/doc/map.txt src/ex_docmd.c src/ex_getln.c src/proto/ex_docmd.pro src/testdir/test_cmdline.vim src/version.c src/vim.h |
diffstat | 8 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4287,7 +4287,9 @@ getcompletion({pat}, {type} [, {filtered locale locale names (as output of locale -a) mapping mapping name menu menus + messages |:messages| suboptions option options + packadd optional package |pack-add| names shellcmd Shell command sign |:sign| suboptions syntax syntax file names |'syntax'|
--- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1280,6 +1280,7 @@ completion can be enabled: -complete=locale locale names (as output of locale -a) -complete=mapping mapping name -complete=menu menus + -complete=messages |:messages| suboptions -complete=option options -complete=packadd optional package |pack-add| names -complete=shellcmd Shell command
--- 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 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
--- 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
--- 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 : */
--- 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']