mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.4.542
Problem: Using a range for window and buffer commands has a few problems. Cannot specify the type of range for a user command. Solution: Add the -addr argument for user commands. Fix problems. (Marcin Szamotulski)
This commit is contained in:
@@ -1358,6 +1358,19 @@ Possible attributes are:
|
||||
Note that -range=N and -count=N are mutually exclusive - only one should be
|
||||
specified.
|
||||
|
||||
*E889* *:command-addr*
|
||||
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 buffer,
|
||||
relate to arguments, (loaded) buffers, windows or tab pages.
|
||||
|
||||
Possible values are:
|
||||
-addr=lines Range of lines (this is the default)
|
||||
-addr=arguments Range for arguments
|
||||
-addr=buffers Range for buffers (also not loaded buffers)
|
||||
-addr=loaded_buffers Range for loaded buffers
|
||||
-addr=windows Range for windows
|
||||
-addr=tabs Range for tab pages
|
||||
|
||||
Special cases *:command-bang* *:command-bar*
|
||||
*:command-register* *:command-buffer*
|
||||
There are some special cases as well:
|
||||
|
@@ -1896,6 +1896,7 @@ test1 \
|
||||
test_breakindent \
|
||||
test_changelist \
|
||||
test_close_count \
|
||||
test_command_count \
|
||||
test_eval \
|
||||
test_insertcount \
|
||||
test_listlbr \
|
||||
|
@@ -63,7 +63,7 @@
|
||||
#define ADDR_WINDOWS 1
|
||||
#define ADDR_ARGUMENTS 2
|
||||
#define ADDR_LOADED_BUFFERS 3
|
||||
#define ADDR_UNLOADED_BUFFERS 4
|
||||
#define ADDR_BUFFERS 4
|
||||
#define ADDR_TABS 5
|
||||
|
||||
#ifndef DO_DECLARE_EXCMD
|
||||
@@ -161,7 +161,7 @@ EX(CMD_aunmenu, "aunmenu", ex_menu,
|
||||
ADDR_LINES),
|
||||
EX(CMD_buffer, "buffer", ex_buffer,
|
||||
BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR,
|
||||
ADDR_UNLOADED_BUFFERS),
|
||||
ADDR_BUFFERS),
|
||||
EX(CMD_bNext, "bNext", ex_bprevious,
|
||||
BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
|
||||
ADDR_LINES),
|
||||
@@ -227,7 +227,7 @@ EX(CMD_bunload, "bunload", ex_bunload,
|
||||
ADDR_LOADED_BUFFERS),
|
||||
EX(CMD_bwipeout, "bwipeout", ex_bunload,
|
||||
BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR,
|
||||
ADDR_UNLOADED_BUFFERS),
|
||||
ADDR_BUFFERS),
|
||||
EX(CMD_change, "change", ex_change,
|
||||
BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY,
|
||||
ADDR_LINES),
|
||||
@@ -1184,7 +1184,7 @@ EX(CMD_saveas, "saveas", ex_write,
|
||||
ADDR_LINES),
|
||||
EX(CMD_sbuffer, "sbuffer", ex_buffer,
|
||||
BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR,
|
||||
ADDR_UNLOADED_BUFFERS),
|
||||
ADDR_BUFFERS),
|
||||
EX(CMD_sbNext, "sbNext", ex_bprevious,
|
||||
RANGE|NOTADR|COUNT|EDITCMD|TRLBAR,
|
||||
ADDR_LINES),
|
||||
|
214
src/ex_docmd.c
214
src/ex_docmd.c
@@ -27,6 +27,7 @@ typedef struct ucmd
|
||||
char_u *uc_rep; /* The command's replacement string */
|
||||
long uc_def; /* The default value for a range/count */
|
||||
int uc_compl; /* completion type */
|
||||
int uc_addr_type; /* The command's address type */
|
||||
# ifdef FEAT_EVAL
|
||||
scid_T uc_scriptID; /* SID where the command was defined */
|
||||
# ifdef FEAT_CMDL_COMPL
|
||||
@@ -2136,7 +2137,11 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
)
|
||||
ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type;
|
||||
else
|
||||
#ifdef FEAT_USR_CMDS
|
||||
if (ea.cmdidx != CMD_USER)
|
||||
#endif
|
||||
ea.addr_type = ADDR_LINES;
|
||||
/* ea.addr_type for user commands is set by find_ucmd */
|
||||
ea.cmd = cmd;
|
||||
|
||||
/* repeat for all ',' or ';' separated addresses */
|
||||
@@ -2157,7 +2162,7 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
ea.line2 = curwin->w_arg_idx + 1;
|
||||
break;
|
||||
case ADDR_LOADED_BUFFERS:
|
||||
case ADDR_UNLOADED_BUFFERS:
|
||||
case ADDR_BUFFERS:
|
||||
ea.line2 = curbuf->b_fnum;
|
||||
break;
|
||||
case ADDR_TABS:
|
||||
@@ -2191,18 +2196,34 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
buf = buf->b_prev;
|
||||
ea.line2 = buf->b_fnum;
|
||||
break;
|
||||
case ADDR_UNLOADED_BUFFERS:
|
||||
case ADDR_BUFFERS:
|
||||
ea.line1 = firstbuf->b_fnum;
|
||||
ea.line2 = lastbuf->b_fnum;
|
||||
break;
|
||||
case ADDR_WINDOWS:
|
||||
case ADDR_TABS:
|
||||
errormsg = (char_u *)_(e_invrange);
|
||||
goto doend;
|
||||
if (IS_USER_CMDIDX(ea.cmdidx))
|
||||
{
|
||||
ea.line1 = 1;
|
||||
ea.line2 = ea.addr_type == ADDR_WINDOWS
|
||||
? LAST_WIN_NR : LAST_TAB_NR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* there is no Vim command which uses '%' and
|
||||
* ADDR_WINDOWS or ADDR_TABS */
|
||||
errormsg = (char_u *)_(e_invrange);
|
||||
goto doend;
|
||||
}
|
||||
break;
|
||||
case ADDR_ARGUMENTS:
|
||||
ea.line1 = 1;
|
||||
ea.line2 = ARGCOUNT;
|
||||
if (ARGCOUNT == 0)
|
||||
ea.line1 = ea.line2 = 0;
|
||||
else
|
||||
{
|
||||
ea.line1 = 1;
|
||||
ea.line2 = ARGCOUNT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
++ea.addr_count;
|
||||
@@ -2629,8 +2650,41 @@ do_one_cmd(cmdlinep, sourcing,
|
||||
|
||||
if ((ea.argt & DFLALL) && ea.addr_count == 0)
|
||||
{
|
||||
buf_T *buf;
|
||||
|
||||
ea.line1 = 1;
|
||||
ea.line2 = curbuf->b_ml.ml_line_count;
|
||||
switch (ea.addr_type)
|
||||
{
|
||||
case ADDR_LINES:
|
||||
ea.line2 = curbuf->b_ml.ml_line_count;
|
||||
break;
|
||||
case ADDR_LOADED_BUFFERS:
|
||||
buf = firstbuf;
|
||||
while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL)
|
||||
buf = buf->b_next;
|
||||
ea.line1 = buf->b_fnum;
|
||||
buf = lastbuf;
|
||||
while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL)
|
||||
buf = buf->b_prev;
|
||||
ea.line2 = buf->b_fnum;
|
||||
break;
|
||||
case ADDR_BUFFERS:
|
||||
ea.line1 = firstbuf->b_fnum;
|
||||
ea.line2 = lastbuf->b_fnum;
|
||||
break;
|
||||
case ADDR_WINDOWS:
|
||||
ea.line2 = LAST_WIN_NR;
|
||||
break;
|
||||
case ADDR_TABS:
|
||||
ea.line2 = LAST_TAB_NR;
|
||||
break;
|
||||
case ADDR_ARGUMENTS:
|
||||
if (ARGCOUNT == 0)
|
||||
ea.line1 = ea.line2 = 0;
|
||||
else
|
||||
ea.line2 = ARGCOUNT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* accept numbered register only when no count allowed (:put) */
|
||||
@@ -3211,6 +3265,7 @@ find_ucmd(eap, p, full, xp, compl)
|
||||
eap->cmdidx = CMD_USER_BUF;
|
||||
eap->argt = (long)uc->uc_argt;
|
||||
eap->useridx = j;
|
||||
eap->addr_type = uc->uc_addr_type;
|
||||
|
||||
# ifdef FEAT_CMDL_COMPL
|
||||
if (compl != NULL)
|
||||
@@ -3839,7 +3894,7 @@ set_one_cmd_context(xp, buff)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* For the -complete and -nargs attributes, we complete
|
||||
/* For the -complete, -nargs and -addr attributes, we complete
|
||||
* their arguments as well.
|
||||
*/
|
||||
if (STRNICMP(arg, "complete", p - arg) == 0)
|
||||
@@ -3854,6 +3909,12 @@ set_one_cmd_context(xp, buff)
|
||||
xp->xp_pattern = p + 1;
|
||||
return NULL;
|
||||
}
|
||||
else if (STRNICMP(arg, "addr", p - arg) == 0)
|
||||
{
|
||||
xp->xp_context = EXPAND_USER_ADDR_TYPE;
|
||||
xp->xp_pattern = p + 1;
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
arg = skipwhite(p);
|
||||
@@ -4264,6 +4325,7 @@ get_address(ptr, addr_type, skip, to_other_file)
|
||||
pos_T pos;
|
||||
pos_T *fp;
|
||||
linenr_T lnum;
|
||||
buf_T *buf;
|
||||
|
||||
cmd = skipwhite(*ptr);
|
||||
lnum = MAXLNUM;
|
||||
@@ -4285,7 +4347,7 @@ get_address(ptr, addr_type, skip, to_other_file)
|
||||
lnum = curwin->w_arg_idx + 1;
|
||||
break;
|
||||
case ADDR_LOADED_BUFFERS:
|
||||
case ADDR_UNLOADED_BUFFERS:
|
||||
case ADDR_BUFFERS:
|
||||
lnum = curbuf->b_fnum;
|
||||
break;
|
||||
case ADDR_TABS:
|
||||
@@ -4308,7 +4370,16 @@ get_address(ptr, addr_type, skip, to_other_file)
|
||||
lnum = ARGCOUNT;
|
||||
break;
|
||||
case ADDR_LOADED_BUFFERS:
|
||||
case ADDR_UNLOADED_BUFFERS:
|
||||
buf = lastbuf;
|
||||
while (buf->b_ml.ml_mfp == NULL)
|
||||
{
|
||||
if (buf->b_prev == NULL)
|
||||
break;
|
||||
buf = buf->b_prev;
|
||||
}
|
||||
lnum = buf->b_fnum;
|
||||
break;
|
||||
case ADDR_BUFFERS:
|
||||
lnum = lastbuf->b_fnum;
|
||||
break;
|
||||
case ADDR_TABS:
|
||||
@@ -4477,7 +4548,7 @@ get_address(ptr, addr_type, skip, to_other_file)
|
||||
lnum = curwin->w_arg_idx + 1;
|
||||
break;
|
||||
case ADDR_LOADED_BUFFERS:
|
||||
case ADDR_UNLOADED_BUFFERS:
|
||||
case ADDR_BUFFERS:
|
||||
lnum = curbuf->b_fnum;
|
||||
break;
|
||||
case ADDR_TABS:
|
||||
@@ -4495,7 +4566,7 @@ get_address(ptr, addr_type, skip, to_other_file)
|
||||
else
|
||||
n = getdigits(&cmd);
|
||||
if (addr_type == ADDR_LOADED_BUFFERS
|
||||
|| addr_type == ADDR_UNLOADED_BUFFERS)
|
||||
|| addr_type == ADDR_BUFFERS)
|
||||
lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n);
|
||||
else if (i == '-')
|
||||
lnum -= n;
|
||||
@@ -4531,7 +4602,7 @@ get_address(ptr, addr_type, skip, to_other_file)
|
||||
lnum = LAST_WIN_NR;
|
||||
break;
|
||||
case ADDR_LOADED_BUFFERS:
|
||||
case ADDR_UNLOADED_BUFFERS:
|
||||
case ADDR_BUFFERS:
|
||||
if (lnum < firstbuf->b_fnum)
|
||||
{
|
||||
lnum = firstbuf->b_fnum;
|
||||
@@ -5585,14 +5656,14 @@ get_command_name(xp, idx)
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_USR_CMDS) || defined(PROTO)
|
||||
static int uc_add_command __ARGS((char_u *name, size_t name_len, char_u *rep, long argt, long def, int flags, int compl, char_u *compl_arg, int force));
|
||||
static int uc_add_command __ARGS((char_u *name, size_t name_len, char_u *rep, long argt, long def, int flags, int compl, char_u *compl_arg, int addr_type, int force));
|
||||
static void uc_list __ARGS((char_u *name, size_t name_len));
|
||||
static int uc_scan_attr __ARGS((char_u *attr, size_t len, long *argt, long *def, int *flags, int *compl, char_u **compl_arg));
|
||||
static int uc_scan_attr __ARGS((char_u *attr, size_t len, long *argt, long *def, int *flags, int *compl, char_u **compl_arg, int* attr_type_arg));
|
||||
static char_u *uc_split_args __ARGS((char_u *arg, size_t *lenp));
|
||||
static size_t uc_check_code __ARGS((char_u *code, size_t len, char_u *buf, ucmd_T *cmd, exarg_T *eap, char_u **split_buf, size_t *split_len));
|
||||
|
||||
static int
|
||||
uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force)
|
||||
uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, addr_type, force)
|
||||
char_u *name;
|
||||
size_t name_len;
|
||||
char_u *rep;
|
||||
@@ -5601,6 +5672,7 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force)
|
||||
int flags;
|
||||
int compl;
|
||||
char_u *compl_arg;
|
||||
int addr_type;
|
||||
int force;
|
||||
{
|
||||
ucmd_T *cmd = NULL;
|
||||
@@ -5695,6 +5767,7 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force)
|
||||
cmd->uc_compl_arg = compl_arg;
|
||||
# endif
|
||||
#endif
|
||||
cmd->uc_addr_type = addr_type;
|
||||
|
||||
return OK;
|
||||
|
||||
@@ -5707,6 +5780,23 @@ fail:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_USR_CMDS)
|
||||
static struct
|
||||
{
|
||||
int expand;
|
||||
char *name;
|
||||
} addr_type_complete[] =
|
||||
{
|
||||
{ADDR_ARGUMENTS, "arguments"},
|
||||
{ADDR_LINES, "lines"},
|
||||
{ADDR_LOADED_BUFFERS, "loaded_buffers"},
|
||||
{ADDR_TABS, "tabs"},
|
||||
{ADDR_BUFFERS, "buffers"},
|
||||
{ADDR_WINDOWS, "windows"},
|
||||
{-1, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_USR_CMDS) || defined(FEAT_EVAL) || defined(PROTO)
|
||||
/*
|
||||
* List of names for completion for ":command" with the EXPAND_ flag.
|
||||
@@ -5794,7 +5884,7 @@ uc_list(name, name_len)
|
||||
|
||||
/* Put out the title first time */
|
||||
if (!found)
|
||||
MSG_PUTS_TITLE(_("\n Name Args Range Complete Definition"));
|
||||
MSG_PUTS_TITLE(_("\n Name Args Address Complete Definition"));
|
||||
found = TRUE;
|
||||
msg_putchar('\n');
|
||||
if (got_int)
|
||||
@@ -5855,6 +5945,20 @@ uc_list(name, name_len)
|
||||
IObuff[len++] = ' ';
|
||||
} while (len < 11);
|
||||
|
||||
/* Address Type */
|
||||
for (j = 0; addr_type_complete[j].expand != -1; ++j)
|
||||
if (addr_type_complete[j].expand != ADDR_LINES
|
||||
&& addr_type_complete[j].expand == cmd->uc_addr_type)
|
||||
{
|
||||
STRCPY(IObuff + len, addr_type_complete[j].name);
|
||||
len += (int)STRLEN(IObuff + len);
|
||||
break;
|
||||
}
|
||||
|
||||
do {
|
||||
IObuff[len++] = ' ';
|
||||
} while (len < 21);
|
||||
|
||||
/* Completion */
|
||||
for (j = 0; command_complete[j].expand != 0; ++j)
|
||||
if (command_complete[j].expand == cmd->uc_compl)
|
||||
@@ -5866,7 +5970,7 @@ uc_list(name, name_len)
|
||||
|
||||
do {
|
||||
IObuff[len++] = ' ';
|
||||
} while (len < 21);
|
||||
} while (len < 35);
|
||||
|
||||
IObuff[len] = '\0';
|
||||
msg_outtrans(IObuff);
|
||||
@@ -5906,7 +6010,7 @@ uc_fun_cmd()
|
||||
}
|
||||
|
||||
static int
|
||||
uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg)
|
||||
uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg, addr_type_arg)
|
||||
char_u *attr;
|
||||
size_t len;
|
||||
long *argt;
|
||||
@@ -5914,6 +6018,7 @@ uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg)
|
||||
int *flags;
|
||||
int *compl;
|
||||
char_u **compl_arg;
|
||||
int *addr_type_arg;
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@@ -6032,6 +6137,20 @@ invalid_count:
|
||||
== FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
else if (STRNICMP(attr, "addr", attrlen) == 0)
|
||||
{
|
||||
*argt |= RANGE;
|
||||
if (val == NULL)
|
||||
{
|
||||
EMSG(_("E179: argument required for -addr"));
|
||||
return FAIL;
|
||||
}
|
||||
if (parse_addr_type_arg(val, (int)vallen, argt, addr_type_arg)
|
||||
== FAIL)
|
||||
return FAIL;
|
||||
if (addr_type_arg != ADDR_LINES)
|
||||
*argt |= (ZEROR | NOTADR) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
char_u ch = attr[len];
|
||||
@@ -6060,6 +6179,7 @@ ex_command(eap)
|
||||
int flags = 0;
|
||||
int compl = EXPAND_NOTHING;
|
||||
char_u *compl_arg = NULL;
|
||||
int addr_type_arg = ADDR_LINES;
|
||||
int has_attr = (eap->arg[0] == '-');
|
||||
int name_len;
|
||||
|
||||
@@ -6070,7 +6190,7 @@ ex_command(eap)
|
||||
{
|
||||
++p;
|
||||
end = skiptowhite(p);
|
||||
if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, &compl_arg)
|
||||
if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, &compl_arg, &addr_type_arg)
|
||||
== FAIL)
|
||||
return;
|
||||
p = skipwhite(end);
|
||||
@@ -6111,7 +6231,7 @@ ex_command(eap)
|
||||
}
|
||||
else
|
||||
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
|
||||
eap->forceit);
|
||||
addr_type_arg, eap->forceit);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6651,6 +6771,17 @@ get_user_commands(xp, idx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the list of user address type names.
|
||||
*/
|
||||
char_u *
|
||||
get_user_cmd_addr_type(xp, idx)
|
||||
expand_T *xp UNUSED;
|
||||
int idx;
|
||||
{
|
||||
return (char_u *)addr_type_complete[idx].name;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the list of user command
|
||||
* attributes.
|
||||
@@ -6661,8 +6792,8 @@ get_user_cmd_flags(xp, idx)
|
||||
int idx;
|
||||
{
|
||||
static char *user_cmd_flags[] =
|
||||
{"bang", "bar", "buffer", "complete", "count",
|
||||
"nargs", "range", "register"};
|
||||
{"addr", "bang", "bar", "buffer", "complete",
|
||||
"count", "nargs", "range", "register"};
|
||||
|
||||
if (idx >= (int)(sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0])))
|
||||
return NULL;
|
||||
@@ -6696,6 +6827,43 @@ get_user_cmd_complete(xp, idx)
|
||||
}
|
||||
# endif /* FEAT_CMDL_COMPL */
|
||||
|
||||
/*
|
||||
* Parse address type argument
|
||||
*/
|
||||
int
|
||||
parse_addr_type_arg(value, vallen, argt, addr_type_arg)
|
||||
char_u *value;
|
||||
int vallen;
|
||||
long *argt;
|
||||
int *addr_type_arg;
|
||||
{
|
||||
int i, a, b;
|
||||
for (i = 0; addr_type_complete[i].expand != -1; ++i)
|
||||
{
|
||||
a = (int)STRLEN(addr_type_complete[i].name) == vallen;
|
||||
b = STRNCMP(value, addr_type_complete[i].name, vallen) == 0;
|
||||
if (a && b)
|
||||
{
|
||||
*addr_type_arg = addr_type_complete[i].expand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (addr_type_complete[i].expand == -1)
|
||||
{
|
||||
char_u *err = value;
|
||||
for (i=0; err[i] == NUL || !vim_iswhite(err[i]); i++);
|
||||
err[i] = NUL;
|
||||
EMSG2(_("E180: Invalid address type value: %s"), err);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (*addr_type_arg != ADDR_LINES)
|
||||
*argt |= NOTADR;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* FEAT_USR_CMDS */
|
||||
|
||||
#if defined(FEAT_USR_CMDS) || defined(FEAT_EVAL) || defined(PROTO)
|
||||
|
@@ -4697,6 +4697,7 @@ ExpandFromContext(xp, pat, num_file, file, options)
|
||||
#endif
|
||||
#ifdef FEAT_USR_CMDS
|
||||
{EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
|
||||
{EXPAND_USER_ADDR_TYPE, get_user_cmd_addr_type, FALSE, TRUE},
|
||||
{EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
|
||||
{EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE},
|
||||
{EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE},
|
||||
|
@@ -19,9 +19,11 @@ char_u *get_command_name __ARGS((expand_T *xp, int idx));
|
||||
void ex_comclear __ARGS((exarg_T *eap));
|
||||
void uc_clear __ARGS((garray_T *gap));
|
||||
char_u *get_user_commands __ARGS((expand_T *xp, int idx));
|
||||
char_u *get_user_cmd_addr_type __ARGS((expand_T *xp, int idx));
|
||||
char_u *get_user_cmd_flags __ARGS((expand_T *xp, int idx));
|
||||
char_u *get_user_cmd_nargs __ARGS((expand_T *xp, int idx));
|
||||
char_u *get_user_cmd_complete __ARGS((expand_T *xp, int idx));
|
||||
int parse_addr_type_arg __ARGS((char_u *value, int vallen, long *argt, int *addr_type_arg));
|
||||
int parse_compl_arg __ARGS((char_u *value, int vallen, int *complp, long *argt, char_u **compl_arg));
|
||||
void not_exiting __ARGS((void));
|
||||
void tabpage_close __ARGS((int forceit));
|
||||
@@ -43,6 +45,7 @@ void free_cd_dir __ARGS((void));
|
||||
void post_chdir __ARGS((int local));
|
||||
void ex_cd __ARGS((exarg_T *eap));
|
||||
void do_sleep __ARGS((long msec));
|
||||
void ex_may_print __ARGS((exarg_T *eap));
|
||||
int vim_mkdir_emsg __ARGS((char_u *name, int prot));
|
||||
FILE *open_exfile __ARGS((char_u *fname, int forceit, char *mode));
|
||||
void update_topline_cursor __ARGS((void));
|
||||
@@ -54,5 +57,4 @@ int put_eol __ARGS((FILE *fd));
|
||||
int put_line __ARGS((FILE *fd, char *s));
|
||||
void dialog_msg __ARGS((char_u *buff, char *format, char_u *fname));
|
||||
char_u *get_behave_arg __ARGS((expand_T *xp, int idx));
|
||||
void ex_may_print __ARGS((exarg_T *eap));
|
||||
/* vim: set ft=c : */
|
||||
|
@@ -41,6 +41,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test_breakindent.out \
|
||||
test_changelist.out \
|
||||
test_close_count.out \
|
||||
test_command_count.out \
|
||||
test_eval.out \
|
||||
test_insertcount.out \
|
||||
test_listlbr.out \
|
||||
@@ -178,6 +179,7 @@ test_autoformat_join.out: test_autoformat_join.in
|
||||
test_breakindent.out: test_breakindent.in
|
||||
test_changelist.out: test_changelist.in
|
||||
test_close_count.out: test_close_count.in
|
||||
test_command_count.out: test_command_count.in
|
||||
test_eval.out: test_eval.in
|
||||
test_insertcount.out: test_insertcount.in
|
||||
test_listlbr.out: test_listlbr.in
|
||||
|
@@ -40,6 +40,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test_breakindent.out \
|
||||
test_changelist.out \
|
||||
test_close_count.out \
|
||||
test_command_count.out \
|
||||
test_eval.out \
|
||||
test_insertcount.out \
|
||||
test_listlbr.out \
|
||||
|
@@ -62,6 +62,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
|
||||
test_breakindent.out \
|
||||
test_changelist.out \
|
||||
test_close_count.out \
|
||||
test_command_count.out \
|
||||
test_eval.out \
|
||||
test_insertcount.out \
|
||||
test_listlbr.out \
|
||||
|
@@ -42,6 +42,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
|
||||
test_breakindent.out \
|
||||
test_changelist.out \
|
||||
test_close_count.out \
|
||||
test_command_count.out \
|
||||
test_eval.out \
|
||||
test_insertcount.out \
|
||||
test_listlbr.out \
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
|
||||
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
|
||||
#
|
||||
# Last change: 2014 Nov 27
|
||||
# Last change: 2014 Dec 08
|
||||
#
|
||||
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
|
||||
# Edit the lines in the Configuration section below to select.
|
||||
@@ -101,6 +101,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
|
||||
test_breakindent.out \
|
||||
test_changelist.out \
|
||||
test_close_count.out \
|
||||
test_command_count.out \
|
||||
test_eval.out \
|
||||
test_insertcount.out \
|
||||
test_listlbr.out \
|
||||
|
@@ -38,6 +38,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
||||
test_breakindent.out \
|
||||
test_changelist.out \
|
||||
test_close_count.out \
|
||||
test_command_count.out \
|
||||
test_eval.out \
|
||||
test_insertcount.out \
|
||||
test_listlbr.out \
|
||||
|
50
src/testdir/test_command_count.in
Normal file
50
src/testdir/test_command_count.in
Normal file
@@ -0,0 +1,50 @@
|
||||
Test for user command counts vim: set ft=vim :
|
||||
|
||||
STARTTEST
|
||||
:let g:lines = []
|
||||
:so tiny.vim
|
||||
:com -range RangeLines :call add(g:lines, 'Rangeg:Lines '.<line1>.' '.<line2>)
|
||||
:com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '.<line1>.' '.<line2>)
|
||||
:com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '.<line1>.' '.<line2>)
|
||||
:com -range -addr=loaded_buffers RangeLoadedBuffers :call add(g:lines, 'RangeLoadedBuffers '.<line1>.' '.<line2>)
|
||||
:com -range=% -addr=loaded_buffers RangeLoadedBuffersAll :call add(g:lines, 'RangeLoadedBuffersAll '.<line1>.' '.<line2>)
|
||||
:com -range -addr=buffers RangeBuffers :call add(g:lines, 'RangeBuffers '.<line1>.' '.<line2>)
|
||||
:com -range=% -addr=buffers RangeBuffersAll :call add(g:lines, 'RangeBuffersAll '.<line1>.' '.<line2>)
|
||||
:com -range -addr=windows RangeWindows :call add(g:lines, 'RangeWindows '.<line1>.' '.<line2>)
|
||||
:com -range=% -addr=windows RangeWindowsAll :call add(g:lines, 'RangeWindowsAll '.<line1>.' '.<line2>)
|
||||
:com -range -addr=tabs RangeTabs :call add(g:lines, 'RangeTabs '.<line1>.' '.<line2>)
|
||||
:com -range=% -addr=tabs RangeTabsAll :call add(g:lines, 'RangeTabsAll '.<line1>.' '.<line2>)
|
||||
:set hidden
|
||||
:arga a b c d
|
||||
:argdo echo "loading buffers"
|
||||
:argu 3
|
||||
:.-,$-RangeArguments
|
||||
:%RangeArguments
|
||||
:RangeArgumentsAll
|
||||
:N
|
||||
:.RangeArguments
|
||||
:split|split|split|split
|
||||
:3wincmd w
|
||||
:.,$RangeWindows
|
||||
:%RangeWindows
|
||||
:RangeWindowsAll
|
||||
:only
|
||||
:blast|bd
|
||||
:.,$RangeLoadedBuffers
|
||||
:%RangeLoadedBuffers
|
||||
:RangeLoadedBuffersAll
|
||||
:.,$RangeBuffers
|
||||
:%RangeBuffers
|
||||
:RangeBuffersAll
|
||||
:tabe|tabe|tabe|tabe
|
||||
:normal 2gt
|
||||
:.,$RangeTabs
|
||||
:%RangeTabs
|
||||
:RangeTabsAll
|
||||
:1tabonly
|
||||
:e! test.out
|
||||
:call append(0, g:lines)
|
||||
:w|qa!
|
||||
ENDTEST
|
||||
|
||||
|
17
src/testdir/test_command_count.ok
Normal file
17
src/testdir/test_command_count.ok
Normal file
@@ -0,0 +1,17 @@
|
||||
RangeArguments 2 4
|
||||
RangeArguments 1 5
|
||||
RangeArgumentsAll 1 5
|
||||
RangeArguments 2 2
|
||||
RangeWindows 3 5
|
||||
RangeWindows 1 5
|
||||
RangeWindowsAll 1 5
|
||||
RangeLoadedBuffers 2 4
|
||||
RangeLoadedBuffers 1 4
|
||||
RangeLoadedBuffersAll 1 4
|
||||
RangeBuffers 2 5
|
||||
RangeBuffers 1 5
|
||||
RangeBuffersAll 1 5
|
||||
RangeTabs 2 5
|
||||
RangeTabs 1 5
|
||||
RangeTabsAll 1 5
|
||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
542,
|
||||
/**/
|
||||
541,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user