Skip to content

Commit 9e507ca

Browse files
committed
patch 8.0.0034
Problem: No completion for ":messages". Solution: Complete "clear" argument. (Hirohito Higashi)
1 parent a6c27ee commit 9e507ca

8 files changed

Lines changed: 31 additions & 0 deletions

File tree

runtime/doc/eval.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4287,7 +4287,9 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
42874287
locale locale names (as output of locale -a)
42884288
mapping mapping name
42894289
menu menus
4290+
messages |:messages| suboptions
42904291
option options
4292+
packadd optional package |pack-add| names
42914293
shellcmd Shell command
42924294
sign |:sign| suboptions
42934295
syntax syntax file names |'syntax'|

runtime/doc/map.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ completion can be enabled:
12801280
-complete=locale locale names (as output of locale -a)
12811281
-complete=mapping mapping name
12821282
-complete=menu menus
1283+
-complete=messages |:messages| suboptions
12831284
-complete=option options
12841285
-complete=packadd optional package |pack-add| names
12851286
-complete=shellcmd Shell command

src/ex_docmd.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4281,6 +4281,11 @@ set_one_cmd_context(
42814281
xp->xp_pattern = arg;
42824282
break;
42834283

4284+
case CMD_messages:
4285+
xp->xp_context = EXPAND_MESSAGES;
4286+
xp->xp_pattern = arg;
4287+
break;
4288+
42844289
#if defined(FEAT_CMDHIST)
42854290
case CMD_history:
42864291
xp->xp_context = EXPAND_HISTORY;
@@ -5893,6 +5898,7 @@ static struct
58935898
#endif
58945899
{EXPAND_MAPPINGS, "mapping"},
58955900
{EXPAND_MENUS, "menu"},
5901+
{EXPAND_MESSAGES, "messages"},
58965902
{EXPAND_OWNSYNTAX, "syntax"},
58975903
#if defined(FEAT_PROFILE)
58985904
{EXPAND_SYNTIME, "syntime"},
@@ -11901,6 +11907,18 @@ get_behave_arg(expand_T *xp UNUSED, int idx)
1190111907
return (char_u *)"xterm";
1190211908
return NULL;
1190311909
}
11910+
11911+
/*
11912+
* Function given to ExpandGeneric() to obtain the possible arguments of the
11913+
* ":messages {clear}" command.
11914+
*/
11915+
char_u *
11916+
get_messages_arg(expand_T *xp UNUSED, int idx)
11917+
{
11918+
if (idx == 0)
11919+
return (char_u *)"clear";
11920+
return NULL;
11921+
}
1190411922
#endif
1190511923

1190611924
#ifdef FEAT_AUTOCMD

src/ex_getln.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4832,6 +4832,7 @@ ExpandFromContext(
48324832
{
48334833
{EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
48344834
{EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
4835+
{EXPAND_MESSAGES, get_messages_arg, TRUE, TRUE},
48354836
#ifdef FEAT_CMDHIST
48364837
{EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
48374838
#endif

src/proto/ex_docmd.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ int put_eol(FILE *fd);
6161
int put_line(FILE *fd, char *s);
6262
void dialog_msg(char_u *buff, char *format, char_u *fname);
6363
char_u *get_behave_arg(expand_T *xp, int idx);
64+
char_u *get_messages_arg(expand_T *xp, int idx);
6465
/* vim: set ft=c : */

src/testdir/test_cmdline.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ func Test_getcompletion()
129129
let l = getcompletion('dark', 'highlight')
130130
call assert_equal([], l)
131131

132+
let l = getcompletion('', 'messages')
133+
call assert_true(index(l, 'clear') >= 0)
134+
let l = getcompletion('not', 'messages')
135+
call assert_equal([], l)
136+
132137
if has('cscope')
133138
let l = getcompletion('', 'cscope')
134139
let cmds = ['add', 'find', 'help', 'kill', 'reset', 'show']

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
34,
767769
/**/
768770
33,
769771
/**/

src/vim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
793793
#define EXPAND_SYNTIME 43
794794
#define EXPAND_USER_ADDR_TYPE 44
795795
#define EXPAND_PACKADD 45
796+
#define EXPAND_MESSAGES 46
796797

797798
/* Values for exmode_active (0 is no exmode) */
798799
#define EXMODE_NORMAL 1

0 commit comments

Comments
 (0)