vim-patch:8.1.1204: output of :command with address completion is not nice

Problem:    Output of :command with address completion is not nice.
Solution:   Shorten the address completion names.
a561a41a70
This commit is contained in:
Jan Edmund Lazo 2019-10-30 02:06:07 -04:00
parent e8c2a8269e
commit ff104e197d
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 26 additions and 23 deletions

View File

@ -1136,9 +1136,10 @@ scripts.
:com[mand] *:com* *:command* :com[mand] *:com* *:command*
List all user-defined commands. When listing commands, List all user-defined commands. When listing commands,
the characters in the first two columns are the characters in the first columns are:
! Command has the -bang attribute ! Command has the -bang attribute
" Command has the -register attribute " Command has the -register attribute
| Command has the -bar attribute
b Command is local to current buffer b Command is local to current buffer
(see below for details on attributes) (see below for details on attributes)
The list can be filtered on command name with The list can be filtered on command name with
@ -1342,14 +1343,15 @@ It is possible that the special characters in the range like `.`, `$` or `%`
which by default correspond to the current line, last line and the whole which by default correspond to the current line, last line and the whole
buffer, relate to arguments, (loaded) buffers, windows or tab pages. buffer, relate to arguments, (loaded) buffers, windows or tab pages.
Possible values are: Possible values are (second column is the short name used in listing):
-addr=lines Range of lines (this is the default) -addr=lines Range of lines (this is the default)
-addr=arguments Range for arguments -addr=arguments arg Range for arguments
-addr=buffers Range for buffers (also not loaded buffers) -addr=buffers buf Range for buffers (also not loaded buffers)
-addr=loaded_buffers Range for loaded buffers -addr=loaded_buffers load Range for loaded buffers
-addr=windows Range for windows -addr=windows win Range for windows
-addr=tabs Range for tab pages -addr=tabs tab Range for tab pages
-addr=other other kind of range -addr=quickfix qf Range for quickfix entries
-addr=other ? other kind of range
Special cases ~ Special cases ~

View File

@ -5058,17 +5058,18 @@ fail:
static struct { static struct {
int expand; int expand;
char *name; char *name;
char *shortname;
} addr_type_complete[] = } addr_type_complete[] =
{ {
{ ADDR_ARGUMENTS, "arguments" }, { ADDR_ARGUMENTS, "arguments", "arg" },
{ ADDR_LINES, "lines" }, { ADDR_LINES, "lines", "line" },
{ ADDR_LOADED_BUFFERS, "loaded_buffers" }, { ADDR_LOADED_BUFFERS, "loaded_buffers", "load" },
{ ADDR_TABS, "tabs" }, { ADDR_TABS, "tabs", "tab" },
{ ADDR_BUFFERS, "buffers" }, { ADDR_BUFFERS, "buffers", "buf" },
{ ADDR_WINDOWS, "windows" }, { ADDR_WINDOWS, "windows", "win" },
{ ADDR_QUICKFIX, "quickfix" }, { ADDR_QUICKFIX, "quickfix", "qf" },
{ ADDR_OTHER, "other" }, { ADDR_OTHER, "other", "?" },
{ -1, NULL } { -1, NULL, NULL }
}; };
/* /*
@ -5153,7 +5154,7 @@ static void uc_list(char_u *name, size_t name_len)
// Put out the title first time // Put out the title first time
if (!found) { if (!found) {
MSG_PUTS_TITLE(_("\n Name Args Address " MSG_PUTS_TITLE(_("\n Name Args Address "
"Complete Definition")); "Complete Definition"));
} }
found = true; found = true;
msg_putchar('\n'); msg_putchar('\n');
@ -5239,13 +5240,13 @@ static void uc_list(char_u *name, size_t name_len)
do { do {
IObuff[len++] = ' '; IObuff[len++] = ' ';
} while (len < 9 - over); } while (len < 8 - over);
// Address Type // Address Type
for (j = 0; addr_type_complete[j].expand != -1; j++) { for (j = 0; addr_type_complete[j].expand != -1; j++) {
if (addr_type_complete[j].expand != ADDR_LINES if (addr_type_complete[j].expand != ADDR_LINES
&& addr_type_complete[j].expand == cmd->uc_addr_type) { && addr_type_complete[j].expand == cmd->uc_addr_type) {
STRCPY(IObuff + len, addr_type_complete[j].name); STRCPY(IObuff + len, addr_type_complete[j].shortname);
len += (int)STRLEN(IObuff + len); len += (int)STRLEN(IObuff + len);
break; break;
} }
@ -5264,13 +5265,13 @@ static void uc_list(char_u *name, size_t name_len)
do { do {
IObuff[len++] = ' '; IObuff[len++] = ' ';
} while (len < 24 - over); } while (len < 25 - over);
IObuff[len] = '\0'; IObuff[len] = '\0';
msg_outtrans(IObuff); msg_outtrans(IObuff);
msg_outtrans_special(cmd->uc_rep, false, msg_outtrans_special(cmd->uc_rep, false,
name_len == 0 ? Columns - 46 : 0); name_len == 0 ? Columns - 47 : 0);
if (p_verbose > 0) { if (p_verbose > 0) {
last_set_msg(cmd->uc_script_ctx); last_set_msg(cmd->uc_script_ctx);
} }