0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.0034

Problem:    No completion for ":messages".
Solution:   Complete "clear" argument. (Hirohito Higashi)
This commit is contained in:
Bram Moolenaar
2016-10-15 15:39:39 +02:00
parent a6c27ee6db
commit 9e507ca8a3
8 changed files with 31 additions and 0 deletions

View File

@@ -4287,7 +4287,9 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
locale locale names (as output of locale -a) locale locale names (as output of locale -a)
mapping mapping name mapping mapping name
menu menus menu menus
messages |:messages| suboptions
option options option options
packadd optional package |pack-add| names
shellcmd Shell command shellcmd Shell command
sign |:sign| suboptions sign |:sign| suboptions
syntax syntax file names |'syntax'| syntax syntax file names |'syntax'|

View File

@@ -1280,6 +1280,7 @@ completion can be enabled:
-complete=locale locale names (as output of locale -a) -complete=locale locale names (as output of locale -a)
-complete=mapping mapping name -complete=mapping mapping name
-complete=menu menus -complete=menu menus
-complete=messages |:messages| suboptions
-complete=option options -complete=option options
-complete=packadd optional package |pack-add| names -complete=packadd optional package |pack-add| names
-complete=shellcmd Shell command -complete=shellcmd Shell command

View File

@@ -4281,6 +4281,11 @@ set_one_cmd_context(
xp->xp_pattern = arg; xp->xp_pattern = arg;
break; break;
case CMD_messages:
xp->xp_context = EXPAND_MESSAGES;
xp->xp_pattern = arg;
break;
#if defined(FEAT_CMDHIST) #if defined(FEAT_CMDHIST)
case CMD_history: case CMD_history:
xp->xp_context = EXPAND_HISTORY; xp->xp_context = EXPAND_HISTORY;
@@ -5893,6 +5898,7 @@ static struct
#endif #endif
{EXPAND_MAPPINGS, "mapping"}, {EXPAND_MAPPINGS, "mapping"},
{EXPAND_MENUS, "menu"}, {EXPAND_MENUS, "menu"},
{EXPAND_MESSAGES, "messages"},
{EXPAND_OWNSYNTAX, "syntax"}, {EXPAND_OWNSYNTAX, "syntax"},
#if defined(FEAT_PROFILE) #if defined(FEAT_PROFILE)
{EXPAND_SYNTIME, "syntime"}, {EXPAND_SYNTIME, "syntime"},
@@ -11901,6 +11907,18 @@ get_behave_arg(expand_T *xp UNUSED, int idx)
return (char_u *)"xterm"; return (char_u *)"xterm";
return NULL; 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 #endif
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD

View File

@@ -4832,6 +4832,7 @@ ExpandFromContext(
{ {
{EXPAND_COMMANDS, get_command_name, FALSE, TRUE}, {EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
{EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE}, {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
{EXPAND_MESSAGES, get_messages_arg, TRUE, TRUE},
#ifdef FEAT_CMDHIST #ifdef FEAT_CMDHIST
{EXPAND_HISTORY, get_history_arg, TRUE, TRUE}, {EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
#endif #endif

View File

@@ -61,4 +61,5 @@ int put_eol(FILE *fd);
int put_line(FILE *fd, char *s); int put_line(FILE *fd, char *s);
void dialog_msg(char_u *buff, char *format, char_u *fname); void dialog_msg(char_u *buff, char *format, char_u *fname);
char_u *get_behave_arg(expand_T *xp, int idx); char_u *get_behave_arg(expand_T *xp, int idx);
char_u *get_messages_arg(expand_T *xp, int idx);
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@@ -129,6 +129,11 @@ func Test_getcompletion()
let l = getcompletion('dark', 'highlight') let l = getcompletion('dark', 'highlight')
call assert_equal([], l) 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') if has('cscope')
let l = getcompletion('', 'cscope') let l = getcompletion('', 'cscope')
let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show'] let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show']

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
34,
/**/ /**/
33, 33,
/**/ /**/

View File

@@ -793,6 +793,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define EXPAND_SYNTIME 43 #define EXPAND_SYNTIME 43
#define EXPAND_USER_ADDR_TYPE 44 #define EXPAND_USER_ADDR_TYPE 44
#define EXPAND_PACKADD 45 #define EXPAND_PACKADD 45
#define EXPAND_MESSAGES 46
/* Values for exmode_active (0 is no exmode) */ /* Values for exmode_active (0 is no exmode) */
#define EXMODE_NORMAL 1 #define EXMODE_NORMAL 1