mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #19669 from zeertzjq/vim-8.2.1278
vim-patch:8.2.{1278,1280,1281}: error message improvements
This commit is contained in:
commit
fea15adad3
@ -969,7 +969,7 @@ char *do_bufdel(int command, char *arg, int addr_count, int start_bnr, int end_b
|
||||
} else {
|
||||
if (addr_count == 2) {
|
||||
if (*arg) { // both range and argument is not allowed
|
||||
return _(e_trailing);
|
||||
return ex_errmsg(e_trailing_arg, arg);
|
||||
}
|
||||
bnr = start_bnr;
|
||||
} else { // addr_count == 1
|
||||
|
@ -544,9 +544,9 @@ int var_redir_start(char *name, int append)
|
||||
clear_lval(redir_lval);
|
||||
if (redir_endp != NULL && *redir_endp != NUL) {
|
||||
// Trailing characters are present after the variable name
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), redir_endp);
|
||||
} else {
|
||||
emsg(_(e_invarg));
|
||||
semsg(_(e_invarg2), name);
|
||||
}
|
||||
redir_endp = NULL; // don't store a value, only cleanup
|
||||
var_redir_stop();
|
||||
@ -1326,7 +1326,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
|
||||
// Don't expand the name when we already know there is an error.
|
||||
if (unlet && !ascii_iswhite(*p) && !ends_excmd(*p)
|
||||
&& *p != '[' && *p != '.') {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1839,7 +1839,7 @@ static void f_eval(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
rettv->v_type = VAR_NUMBER;
|
||||
rettv->vval.v_number = 0;
|
||||
} else if (*s != NUL) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4702,7 +4702,7 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
FNE_CHECK_START);
|
||||
if (end != NULL && lv.ll_name != NULL) {
|
||||
if (*end != NUL) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), end);
|
||||
} else {
|
||||
if (lv.ll_tv == NULL) {
|
||||
di = find_var(lv.ll_name, lv.ll_name_len, NULL, true);
|
||||
|
@ -2039,7 +2039,7 @@ void ex_function(exarg_T *eap)
|
||||
//
|
||||
if (!paren) {
|
||||
if (!ends_excmd(*skipwhite((char *)p))) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), p);
|
||||
goto ret_free;
|
||||
}
|
||||
eap->nextcmd = (char *)check_nextcmd(p);
|
||||
@ -2163,7 +2163,7 @@ void ex_function(exarg_T *eap)
|
||||
if (*p == '\n') {
|
||||
line_arg = p + 1;
|
||||
} else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), p);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2703,7 +2703,7 @@ void ex_delfunction(exarg_T *eap)
|
||||
}
|
||||
if (!ends_excmd(*skipwhite((char *)p))) {
|
||||
xfree(name);
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), p);
|
||||
return;
|
||||
}
|
||||
eap->nextcmd = (char *)check_nextcmd(p);
|
||||
@ -3021,7 +3021,7 @@ void ex_call(exarg_T *eap)
|
||||
if (!ends_excmd(*arg)) {
|
||||
if (!failed && !aborting()) {
|
||||
emsg_severe = true;
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), arg);
|
||||
}
|
||||
} else {
|
||||
eap->nextcmd = (char *)check_nextcmd(arg);
|
||||
|
@ -80,7 +80,7 @@ static list_T *heredoc_get(exarg_T *eap, char *cmd)
|
||||
marker = skipwhite(cmd);
|
||||
p = (char *)skiptowhite((char_u *)marker);
|
||||
if (*skipwhite(p) != NUL && *skipwhite(p) != '"') {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), p);
|
||||
return NULL;
|
||||
}
|
||||
*p = NUL;
|
||||
@ -460,7 +460,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
|
||||
arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
|
||||
if (!ascii_iswhite(*arg) && !ends_excmd(*arg)) {
|
||||
emsg_severe = true;
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), arg);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -808,7 +808,7 @@ static void ex_unletlock(exarg_T *eap, char *argstart, int deep, ex_unletlock_ca
|
||||
|| (!ascii_iswhite(*name_end) && !ends_excmd(*name_end))) {
|
||||
if (name_end != NULL) {
|
||||
emsg_severe = true;
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), name_end);
|
||||
}
|
||||
if (!(eap->skip || error)) {
|
||||
clear_lval(&lv);
|
||||
|
@ -3616,7 +3616,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
|
||||
if (*cmd && *cmd != '"') { // if not end-of-line or comment
|
||||
eap->nextcmd = (char *)check_nextcmd((char_u *)cmd);
|
||||
if (eap->nextcmd == NULL) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), cmd);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ static int execute_cmd0(int *retv, exarg_T *eap, char **errormsg, bool preview)
|
||||
(cmdnames[eap->cmdidx].cmd_func)(eap);
|
||||
}
|
||||
if (eap->errmsg != NULL) {
|
||||
*errormsg = _(eap->errmsg);
|
||||
*errormsg = eap->errmsg;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2266,7 +2266,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
|
||||
if (!ni && !(ea.argt & EX_EXTRA) && *ea.arg != NUL
|
||||
&& *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0)) {
|
||||
// no arguments allowed but there is something
|
||||
errormsg = _(e_trailing);
|
||||
errormsg = ex_errmsg(e_trailing_arg, ea.arg);
|
||||
goto doend;
|
||||
}
|
||||
|
||||
@ -4381,7 +4381,7 @@ static void get_flags(exarg_T *eap)
|
||||
void ex_ni(exarg_T *eap)
|
||||
{
|
||||
if (!eap->skip) {
|
||||
eap->errmsg = N_("E319: The command is not available in this version");
|
||||
eap->errmsg = _("E319: The command is not available in this version");
|
||||
}
|
||||
}
|
||||
|
||||
@ -5018,7 +5018,7 @@ static int get_tabpage_arg(exarg_T *eap)
|
||||
} else if (p == p_save || *p_save == '-' || *p != NUL
|
||||
|| tab_number > LAST_TAB_NR) {
|
||||
// No numbers as argument.
|
||||
eap->errmsg = e_invarg;
|
||||
eap->errmsg = ex_errmsg(e_invarg2, eap->arg);
|
||||
goto theend;
|
||||
}
|
||||
} else {
|
||||
@ -5026,20 +5026,20 @@ static int get_tabpage_arg(exarg_T *eap)
|
||||
tab_number = 1;
|
||||
} else if (p == p_save || *p_save == '-' || *p != NUL || tab_number == 0) {
|
||||
// No numbers as argument.
|
||||
eap->errmsg = e_invarg;
|
||||
eap->errmsg = ex_errmsg(e_invarg2, eap->arg);
|
||||
goto theend;
|
||||
}
|
||||
tab_number = tab_number * relative + tabpage_index(curtab);
|
||||
if (!unaccept_arg0 && relative == -1) {
|
||||
--tab_number;
|
||||
tab_number--;
|
||||
}
|
||||
}
|
||||
if (tab_number < unaccept_arg0 || tab_number > LAST_TAB_NR) {
|
||||
eap->errmsg = e_invarg;
|
||||
eap->errmsg = ex_errmsg(e_invarg2, eap->arg);
|
||||
}
|
||||
} else if (eap->addr_count > 0) {
|
||||
if (unaccept_arg0 && eap->line2 == 0) {
|
||||
eap->errmsg = e_invrange;
|
||||
eap->errmsg = _(e_invrange);
|
||||
tab_number = 0;
|
||||
} else {
|
||||
tab_number = (int)eap->line2;
|
||||
@ -5048,7 +5048,7 @@ static int get_tabpage_arg(exarg_T *eap)
|
||||
if (!unaccept_arg0 && *cmdp == '-') {
|
||||
tab_number--;
|
||||
if (tab_number < unaccept_arg0) {
|
||||
eap->errmsg = e_invarg;
|
||||
eap->errmsg = _(e_invrange);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5078,7 +5078,7 @@ static void ex_autocmd(exarg_T *eap)
|
||||
// directory for security reasons.
|
||||
if (secure) {
|
||||
secure = 2;
|
||||
eap->errmsg = e_curdir;
|
||||
eap->errmsg = _(e_curdir);
|
||||
} else if (eap->cmdidx == CMD_autocmd) {
|
||||
do_autocmd(eap->arg, eap->forceit);
|
||||
} else {
|
||||
@ -5119,7 +5119,7 @@ static void ex_bunload(exarg_T *eap)
|
||||
static void ex_buffer(exarg_T *eap)
|
||||
{
|
||||
if (*eap->arg) {
|
||||
eap->errmsg = e_trailing;
|
||||
eap->errmsg = ex_errmsg(e_trailing_arg, eap->arg);
|
||||
} else {
|
||||
if (eap->addr_count == 0) { // default is current buffer
|
||||
goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0);
|
||||
@ -5943,7 +5943,7 @@ static void ex_recover(exarg_T *eap)
|
||||
/// Command modifier used in a wrong way.
|
||||
static void ex_wrongmodifier(exarg_T *eap)
|
||||
{
|
||||
eap->errmsg = e_invcmd;
|
||||
eap->errmsg = _(e_invcmd);
|
||||
}
|
||||
|
||||
/// :sview [+command] file split window with new file, read-only
|
||||
@ -6052,7 +6052,7 @@ static void ex_tabnext(exarg_T *eap)
|
||||
if (p == p_save || *p_save == '-' || *p_save == '+' || *p != NUL
|
||||
|| tab_number == 0) {
|
||||
// No numbers as argument.
|
||||
eap->errmsg = e_invarg;
|
||||
eap->errmsg = ex_errmsg(e_invarg2, eap->arg);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -6061,7 +6061,7 @@ static void ex_tabnext(exarg_T *eap)
|
||||
} else {
|
||||
tab_number = (int)eap->line2;
|
||||
if (tab_number < 1) {
|
||||
eap->errmsg = e_invrange;
|
||||
eap->errmsg = _(e_invrange);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -6339,7 +6339,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
|
||||
/// ":gui" and ":gvim" when there is no GUI.
|
||||
static void ex_nogui(exarg_T *eap)
|
||||
{
|
||||
eap->errmsg = N_("E25: Nvim does not have a built-in GUI");
|
||||
eap->errmsg = _("E25: Nvim does not have a built-in GUI");
|
||||
}
|
||||
|
||||
static void ex_popup(exarg_T *eap)
|
||||
@ -7274,7 +7274,7 @@ static void ex_mark(exarg_T *eap)
|
||||
if (*eap->arg == NUL) { // No argument?
|
||||
emsg(_(e_argreq));
|
||||
} else if (eap->arg[1] != NUL) { // more than one character?
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), eap->arg);
|
||||
} else {
|
||||
pos = curwin->w_cursor; // save curwin->w_cursor
|
||||
curwin->w_cursor.lnum = eap->line2;
|
||||
@ -7559,7 +7559,7 @@ static void ex_findpat(exarg_T *eap)
|
||||
|
||||
// Check for trailing illegal characters.
|
||||
if (!ends_excmd(*p)) {
|
||||
eap->errmsg = e_trailing;
|
||||
eap->errmsg = ex_errmsg(e_trailing_arg, p);
|
||||
} else {
|
||||
eap->nextcmd = (char *)check_nextcmd((char_u *)p);
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ void ex_if(exarg_T *eap)
|
||||
cstack_T *const cstack = eap->cstack;
|
||||
|
||||
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
||||
eap->errmsg = N_("E579: :if nesting too deep");
|
||||
eap->errmsg = _("E579: :if nesting too deep");
|
||||
} else {
|
||||
++cstack->cs_idx;
|
||||
cstack->cs_flags[cstack->cs_idx] = 0;
|
||||
@ -840,7 +840,7 @@ void ex_endif(exarg_T *eap)
|
||||
if (eap->cstack->cs_idx < 0
|
||||
|| (eap->cstack->cs_flags[eap->cstack->cs_idx]
|
||||
& (CSF_WHILE | CSF_FOR | CSF_TRY))) {
|
||||
eap->errmsg = N_("E580: :endif without :if");
|
||||
eap->errmsg = _("E580: :endif without :if");
|
||||
} else {
|
||||
// When debugging or a breakpoint was encountered, display the debug
|
||||
// prompt (if not already done). This shows the user that an ":endif"
|
||||
@ -870,17 +870,17 @@ void ex_else(exarg_T *eap)
|
||||
|| (cstack->cs_flags[cstack->cs_idx]
|
||||
& (CSF_WHILE | CSF_FOR | CSF_TRY))) {
|
||||
if (eap->cmdidx == CMD_else) {
|
||||
eap->errmsg = N_("E581: :else without :if");
|
||||
eap->errmsg = _("E581: :else without :if");
|
||||
return;
|
||||
}
|
||||
eap->errmsg = N_("E582: :elseif without :if");
|
||||
eap->errmsg = _("E582: :elseif without :if");
|
||||
skip = true;
|
||||
} else if (cstack->cs_flags[cstack->cs_idx] & CSF_ELSE) {
|
||||
if (eap->cmdidx == CMD_else) {
|
||||
eap->errmsg = N_("E583: multiple :else");
|
||||
eap->errmsg = _("E583: multiple :else");
|
||||
return;
|
||||
}
|
||||
eap->errmsg = N_("E584: :elseif after :else");
|
||||
eap->errmsg = _("E584: :elseif after :else");
|
||||
skip = true;
|
||||
}
|
||||
|
||||
@ -940,7 +940,7 @@ void ex_while(exarg_T *eap)
|
||||
cstack_T *const cstack = eap->cstack;
|
||||
|
||||
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
||||
eap->errmsg = N_("E585: :while/:for nesting too deep");
|
||||
eap->errmsg = _("E585: :while/:for nesting too deep");
|
||||
} else {
|
||||
/*
|
||||
* The loop flag is set when we have jumped back from the matching
|
||||
@ -1019,7 +1019,7 @@ void ex_continue(exarg_T *eap)
|
||||
cstack_T *const cstack = eap->cstack;
|
||||
|
||||
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
||||
eap->errmsg = N_("E586: :continue without :while or :for");
|
||||
eap->errmsg = _("E586: :continue without :while or :for");
|
||||
} else {
|
||||
// Try to find the matching ":while". This might stop at a try
|
||||
// conditional not in its finally clause (which is then to be executed
|
||||
@ -1051,7 +1051,7 @@ void ex_break(exarg_T *eap)
|
||||
cstack_T *const cstack = eap->cstack;
|
||||
|
||||
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
||||
eap->errmsg = N_("E587: :break without :while or :for");
|
||||
eap->errmsg = _("E587: :break without :while or :for");
|
||||
} else {
|
||||
// Deactivate conditionals until the matching ":while" or a try
|
||||
// conditional not in its finally clause (which is then to be
|
||||
@ -1083,7 +1083,7 @@ void ex_endwhile(exarg_T *eap)
|
||||
}
|
||||
|
||||
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
|
||||
eap->errmsg = err;
|
||||
eap->errmsg = _(err);
|
||||
} else {
|
||||
fl = cstack->cs_flags[cstack->cs_idx];
|
||||
if (!(fl & csf)) {
|
||||
@ -1097,9 +1097,9 @@ void ex_endwhile(exarg_T *eap)
|
||||
}
|
||||
if (!(fl & (CSF_WHILE | CSF_FOR))) {
|
||||
if (!(fl & CSF_TRY)) {
|
||||
eap->errmsg = e_endif;
|
||||
eap->errmsg = _(e_endif);
|
||||
} else if (fl & CSF_FINALLY) {
|
||||
eap->errmsg = e_endtry;
|
||||
eap->errmsg = _(e_endtry);
|
||||
}
|
||||
// Try to find the matching ":while" and report what's missing.
|
||||
for (idx = cstack->cs_idx; idx > 0; --idx) {
|
||||
@ -1107,7 +1107,7 @@ void ex_endwhile(exarg_T *eap)
|
||||
if ((fl & CSF_TRY) && !(fl & CSF_FINALLY)) {
|
||||
// Give up at a try conditional not in its finally clause.
|
||||
// Ignore the ":endwhile"/":endfor".
|
||||
eap->errmsg = err;
|
||||
eap->errmsg = _(err);
|
||||
return;
|
||||
}
|
||||
if (fl & csf) {
|
||||
@ -1230,7 +1230,7 @@ void ex_try(exarg_T *eap)
|
||||
cstack_T *const cstack = eap->cstack;
|
||||
|
||||
if (cstack->cs_idx == CSTACK_LEN - 1) {
|
||||
eap->errmsg = N_("E601: :try nesting too deep");
|
||||
eap->errmsg = _("E601: :try nesting too deep");
|
||||
} else {
|
||||
++cstack->cs_idx;
|
||||
++cstack->cs_trylevel;
|
||||
@ -1289,7 +1289,7 @@ void ex_catch(exarg_T *eap)
|
||||
char *pat;
|
||||
|
||||
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
|
||||
eap->errmsg = N_("E603: :catch without :try");
|
||||
eap->errmsg = _("E603: :catch without :try");
|
||||
give_up = true;
|
||||
} else {
|
||||
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
|
||||
@ -1306,7 +1306,7 @@ void ex_catch(exarg_T *eap)
|
||||
if (cstack->cs_flags[idx] & CSF_FINALLY) {
|
||||
// Give up for a ":catch" after ":finally" and ignore it.
|
||||
// Just parse.
|
||||
eap->errmsg = N_("E604: :catch after :finally");
|
||||
eap->errmsg = _("E604: :catch after :finally");
|
||||
give_up = true;
|
||||
} else {
|
||||
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
|
||||
@ -1341,7 +1341,7 @@ void ex_catch(exarg_T *eap)
|
||||
if (!skip && (cstack->cs_flags[idx] & CSF_THROWN)
|
||||
&& !(cstack->cs_flags[idx] & CSF_CAUGHT)) {
|
||||
if (end != NULL && *end != NUL && !ends_excmd(*skipwhite(end + 1))) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), end);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1436,7 +1436,7 @@ void ex_finally(exarg_T *eap)
|
||||
cstack_T *const cstack = eap->cstack;
|
||||
|
||||
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
|
||||
eap->errmsg = N_("E606: :finally without :try");
|
||||
eap->errmsg = _("E606: :finally without :try");
|
||||
} else {
|
||||
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
|
||||
eap->errmsg = get_end_emsg(cstack);
|
||||
@ -1455,7 +1455,7 @@ void ex_finally(exarg_T *eap)
|
||||
|
||||
if (cstack->cs_flags[idx] & CSF_FINALLY) {
|
||||
// Give up for a multiple ":finally" and ignore it.
|
||||
eap->errmsg = N_("E607: multiple :finally");
|
||||
eap->errmsg = _("E607: multiple :finally");
|
||||
return;
|
||||
}
|
||||
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
|
||||
@ -1559,7 +1559,7 @@ void ex_endtry(exarg_T *eap)
|
||||
cstack_T *const cstack = eap->cstack;
|
||||
|
||||
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
|
||||
eap->errmsg = N_("E602: :endtry without :try");
|
||||
eap->errmsg = _("E602: :endtry without :try");
|
||||
} else {
|
||||
// Don't do something after an error, interrupt or throw in the try
|
||||
// block, catch clause, or finally clause preceding this ":endtry" or
|
||||
@ -1998,12 +1998,12 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
|
||||
static char *get_end_emsg(cstack_T *cstack)
|
||||
{
|
||||
if (cstack->cs_flags[cstack->cs_idx] & CSF_WHILE) {
|
||||
return e_endwhile;
|
||||
return _(e_endwhile);
|
||||
}
|
||||
if (cstack->cs_flags[cstack->cs_idx] & CSF_FOR) {
|
||||
return e_endfor;
|
||||
return _(e_endfor);
|
||||
}
|
||||
return e_endif;
|
||||
return _(e_endif);
|
||||
}
|
||||
|
||||
/// Rewind conditionals until index "idx" is reached. "cond_type" and
|
||||
|
@ -6525,7 +6525,7 @@ void ex_history(exarg_T *eap)
|
||||
histype1 = 0;
|
||||
histype2 = HIST_COUNT - 1;
|
||||
} else {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), arg);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -6535,7 +6535,7 @@ void ex_history(exarg_T *eap)
|
||||
end = arg;
|
||||
}
|
||||
if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), end);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ EXTERN char e_longname[] INIT(= N_("E75: Name too long"));
|
||||
EXTERN char e_toomsbra[] INIT(= N_("E76: Too many ["));
|
||||
EXTERN char e_toomany[] INIT(= N_("E77: Too many file names"));
|
||||
EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters"));
|
||||
EXTERN char e_trailing2[] INIT(= N_("E488: Trailing characters: %s"));
|
||||
EXTERN char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s"));
|
||||
EXTERN char e_umark[] INIT(= N_("E78: Unknown mark"));
|
||||
EXTERN char e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards"));
|
||||
EXTERN char e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
|
||||
|
@ -1193,7 +1193,7 @@ void ex_match(exarg_T *eap)
|
||||
if (!eap->skip) {
|
||||
if (*end != NUL && !ends_excmd(*skipwhite((char *)end + 1))) {
|
||||
xfree(g);
|
||||
eap->errmsg = e_trailing;
|
||||
eap->errmsg = ex_errmsg(e_trailing_arg, (const char *)end);
|
||||
return;
|
||||
}
|
||||
if (*end != *p) {
|
||||
|
@ -175,7 +175,7 @@ void ex_menu(exarg_T *eap)
|
||||
show_menus(menu_path, modes);
|
||||
goto theend;
|
||||
} else if (*map_to != NUL && (unmenu || enable != kNone)) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), map_to);
|
||||
goto theend;
|
||||
}
|
||||
|
||||
|
@ -3120,7 +3120,7 @@ void qf_list(exarg_T *eap)
|
||||
int idx1 = 1;
|
||||
int idx2 = -1;
|
||||
if (!get_list_range((char_u **)&arg, &idx1, &idx2) || *arg != NUL) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), arg);
|
||||
return;
|
||||
}
|
||||
qf_list_T *qfl = qf_get_curlist(qi);
|
||||
|
@ -1395,7 +1395,7 @@ static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *si
|
||||
filename = arg;
|
||||
*buf = buflist_findnr(getdigits_int((char **)&arg, true, 0));
|
||||
if (*skipwhite((char *)arg) != NUL) {
|
||||
emsg(_(e_trailing));
|
||||
semsg(_(e_trailing_arg), arg);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
|
@ -133,18 +133,18 @@ function Test_tabpage()
|
||||
call assert_fails("99tabmove", 'E16:')
|
||||
call assert_fails("+99tabmove", 'E16:')
|
||||
call assert_fails("-99tabmove", 'E16:')
|
||||
call assert_fails("tabmove foo", 'E474:')
|
||||
call assert_fails("tabmove 99", 'E474:')
|
||||
call assert_fails("tabmove +99", 'E474:')
|
||||
call assert_fails("tabmove -99", 'E474:')
|
||||
call assert_fails("tabmove -3+", 'E474:')
|
||||
call assert_fails("tabmove $3", 'E474:')
|
||||
call assert_fails("tabmove foo", 'E475:')
|
||||
call assert_fails("tabmove 99", 'E475:')
|
||||
call assert_fails("tabmove +99", 'E475:')
|
||||
call assert_fails("tabmove -99", 'E475:')
|
||||
call assert_fails("tabmove -3+", 'E475:')
|
||||
call assert_fails("tabmove $3", 'E475:')
|
||||
call assert_fails("%tabonly", 'E16:')
|
||||
1tabonly!
|
||||
tabmove 1
|
||||
call assert_equal(1, tabpagenr())
|
||||
tabnew
|
||||
call assert_fails("-2tabmove", 'E474:')
|
||||
call assert_fails("-2tabmove", 'E16:')
|
||||
tabonly!
|
||||
endfunc
|
||||
|
||||
@ -320,14 +320,14 @@ function Test_tabpage_with_tabnext()
|
||||
call Check_tab_count(4, 'tabnext -', 3)
|
||||
call Check_tab_count(4, 'tabnext -2', 2)
|
||||
call Check_tab_count(3, 'tabnext $', 5)
|
||||
call assert_fails('tabnext 0', 'E474:')
|
||||
call assert_fails('tabnext .', 'E474:')
|
||||
call assert_fails('tabnext -+', 'E474:')
|
||||
call assert_fails('tabnext +2-', 'E474:')
|
||||
call assert_fails('tabnext $3', 'E474:')
|
||||
call assert_fails('tabnext 99', 'E474:')
|
||||
call assert_fails('tabnext +99', 'E474:')
|
||||
call assert_fails('tabnext -99', 'E474:')
|
||||
call assert_fails('tabnext 0', 'E475:')
|
||||
call assert_fails('tabnext .', 'E475:')
|
||||
call assert_fails('tabnext -+', 'E475:')
|
||||
call assert_fails('tabnext +2-', 'E475:')
|
||||
call assert_fails('tabnext $3', 'E475:')
|
||||
call assert_fails('tabnext 99', 'E475:')
|
||||
call assert_fails('tabnext +99', 'E475:')
|
||||
call assert_fails('tabnext -99', 'E475:')
|
||||
|
||||
1tabonly!
|
||||
endfunction
|
||||
@ -352,7 +352,7 @@ function Test_tabpage_with_tabprevious()
|
||||
let err_code = 'E16:'
|
||||
else
|
||||
let entire_cmd = cmd . ' ' . c
|
||||
let err_code = 'E474:'
|
||||
let err_code = 'E475:'
|
||||
endif
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
endfor
|
||||
@ -451,7 +451,7 @@ function Test_tabpage_with_tabclose()
|
||||
let err_code = 'E16:'
|
||||
else
|
||||
let entire_cmd = 'tabclose ' . c
|
||||
let err_code = 'E474:'
|
||||
let err_code = 'E475:'
|
||||
endif
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
@ -460,8 +460,8 @@ function Test_tabpage_with_tabclose()
|
||||
|
||||
call assert_fails('3tabclose', 'E37:')
|
||||
call assert_fails('tabclose 3', 'E37:')
|
||||
call assert_fails('tabclose -+', 'E474:')
|
||||
call assert_fails('tabclose +2-', 'E474:')
|
||||
call assert_fails('tabclose -+', 'E475:')
|
||||
call assert_fails('tabclose +2-', 'E475:')
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
|
||||
1tabonly!
|
||||
@ -506,7 +506,7 @@ function Test_tabpage_with_tabonly()
|
||||
let err_code = 'E16:'
|
||||
else
|
||||
let entire_cmd = 'tabonly ' . c
|
||||
let err_code = 'E474:'
|
||||
let err_code = 'E475:'
|
||||
endif
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
@ -517,13 +517,13 @@ function Test_tabpage_with_tabonly()
|
||||
for c in tc
|
||||
call s:reconstruct_tabpage_for_test(6)
|
||||
let entire_cmd = 'tabonly' . c[2] . ' ' . c[1]
|
||||
let err_code = 'E474:'
|
||||
let err_code = 'E475:'
|
||||
call assert_fails(entire_cmd, err_code)
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
endfor
|
||||
|
||||
call assert_fails('tabonly -+', 'E474:')
|
||||
call assert_fails('tabonly +2-', 'E474:')
|
||||
call assert_fails('tabonly -+', 'E475:')
|
||||
call assert_fails('tabonly +2-', 'E475:')
|
||||
call assert_equal(6, tabpagenr('$'))
|
||||
|
||||
1tabonly!
|
||||
|
@ -87,14 +87,14 @@ describe(':cquit', function()
|
||||
end)
|
||||
|
||||
it('exits with redir msg for multiple exit codes after :cquit 1 2', function()
|
||||
test_cq('cquit 1 2', nil, 'Vim(cquit):E488: Trailing characters: cquit 1 2')
|
||||
test_cq('cquit 1 2', nil, 'Vim(cquit):E488: Trailing characters: 2: cquit 1 2')
|
||||
end)
|
||||
|
||||
it('exits with redir msg for non-number exit code after :cquit X', function()
|
||||
test_cq('cquit X', nil, 'Vim(cquit):E488: Trailing characters: cquit X')
|
||||
test_cq('cquit X', nil, 'Vim(cquit):E488: Trailing characters: X: cquit X')
|
||||
end)
|
||||
|
||||
it('exits with redir msg for negative exit code after :cquit -1', function()
|
||||
test_cq('cquit -1', nil, 'Vim(cquit):E488: Trailing characters: cquit -1')
|
||||
test_cq('cquit -1', nil, 'Vim(cquit):E488: Trailing characters: -1: cquit -1')
|
||||
end)
|
||||
end)
|
||||
|
@ -16,7 +16,7 @@ describe('Ex cmds', function()
|
||||
command(':echo expand("#<9999999999999999999999999999999999999999")')
|
||||
command(':lockvar 9999999999999999999999999999999999999999')
|
||||
command(':winsize 9999999999999999999999999999999999999999 9999999999999999999999999999999999999999')
|
||||
eq('Vim(tabnext):E474: Invalid argument',
|
||||
eq('Vim(tabnext):E475: Invalid argument: 9999999999999999999999999999999999999999',
|
||||
pcall_err(command, ':tabnext 9999999999999999999999999999999999999999'))
|
||||
eq('Vim(Next):E939: Positive count required',
|
||||
pcall_err(command, ':N 9999999999999999999999999999999999999999'))
|
||||
|
@ -1,239 +0,0 @@
|
||||
-- Tests for tab pages
|
||||
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local feed, insert, source, clear, command, expect, eval, eq =
|
||||
helpers.feed, helpers.insert, helpers.source, helpers.clear,
|
||||
helpers.command, helpers.expect, helpers.eval, helpers.eq
|
||||
local exc_exec = helpers.exc_exec
|
||||
|
||||
describe('tab pages', function()
|
||||
before_each(clear)
|
||||
|
||||
it('can be opened and closed', function()
|
||||
command('tabnew')
|
||||
eq(2, eval('tabpagenr()'))
|
||||
command('quit')
|
||||
eq(1, eval('tabpagenr()'))
|
||||
end)
|
||||
|
||||
it('can be iterated with :tabdo', function()
|
||||
source([[
|
||||
0tabnew
|
||||
1tabnew
|
||||
$tabnew
|
||||
tabdo call append(line('$'), 'this is tab page ' . tabpagenr())
|
||||
tabclose! 2
|
||||
tabrewind
|
||||
]])
|
||||
eq('this is tab page 1', eval("getline('$')"))
|
||||
command('tablast')
|
||||
eq('this is tab page 4', eval("getline('$')"))
|
||||
end)
|
||||
|
||||
it('have local variables accasible with settabvar()/gettabvar()', function()
|
||||
-- Test for settabvar() and gettabvar() functions. Open a new tab page and
|
||||
-- set 3 variables to a number, string and a list. Verify that the
|
||||
-- variables are correctly set.
|
||||
source([[
|
||||
tabnew
|
||||
tabfirst
|
||||
call settabvar(2, 'val_num', 100)
|
||||
call settabvar(2, 'val_str', 'SetTabVar test')
|
||||
call settabvar(2, 'val_list', ['red', 'blue', 'green'])
|
||||
]])
|
||||
|
||||
eq(100, eval('gettabvar(2, "val_num")'))
|
||||
eq('SetTabVar test', eval('gettabvar(2, "val_str")'))
|
||||
eq({'red', 'blue', 'green'}, eval('gettabvar(2, "val_list")'))
|
||||
command('tabnext 2')
|
||||
eq(100, eval('t:val_num'))
|
||||
eq('SetTabVar test', eval('t:val_str'))
|
||||
eq({'red', 'blue', 'green'}, eval('t:val_list'))
|
||||
end)
|
||||
|
||||
it('work together with the drop feature and loaded buffers', function()
|
||||
-- Test for ":tab drop exist-file" to keep current window.
|
||||
command('sp test1')
|
||||
command('tab drop test1')
|
||||
eq(1, eval('tabpagenr("$")'))
|
||||
eq(2, eval('winnr("$")'))
|
||||
eq(1, eval('winnr()'))
|
||||
end)
|
||||
|
||||
it('work together with the drop feature and new files', function()
|
||||
-- Test for ":tab drop new-file" to keep current window of tabpage 1.
|
||||
command('split')
|
||||
command('tab drop newfile')
|
||||
eq(2, eval('tabpagenr("$")'))
|
||||
eq(2, eval('tabpagewinnr(1, "$")'))
|
||||
eq(1, eval('tabpagewinnr(1)'))
|
||||
end)
|
||||
|
||||
it('work together with the drop feature and multi loaded buffers', function()
|
||||
-- Test for ":tab drop multi-opend-file" to keep current tabpage and
|
||||
-- window.
|
||||
command('new test1')
|
||||
command('tabnew')
|
||||
command('new test1')
|
||||
command('tab drop test1')
|
||||
eq(2, eval('tabpagenr()'))
|
||||
eq(2, eval('tabpagewinnr(2, "$")'))
|
||||
eq(1, eval('tabpagewinnr(2)'))
|
||||
end)
|
||||
|
||||
it('can be navigated with :tabmove', function()
|
||||
command('lang C')
|
||||
command('for i in range(9) | tabnew | endfor')
|
||||
feed('1gt')
|
||||
eq(1, eval('tabpagenr()'))
|
||||
command('tabmove 5')
|
||||
eq(5, eval('tabpagenr()'))
|
||||
command('.tabmove')
|
||||
eq(5, eval('tabpagenr()'))
|
||||
command('tabmove -')
|
||||
eq(4, eval('tabpagenr()'))
|
||||
command('tabmove +')
|
||||
eq(5, eval('tabpagenr()'))
|
||||
command('tabmove -2')
|
||||
eq(3, eval('tabpagenr()'))
|
||||
command('tabmove +4')
|
||||
eq(7, eval('tabpagenr()'))
|
||||
command('tabmove')
|
||||
eq(10, eval('tabpagenr()'))
|
||||
command('0tabmove')
|
||||
eq(1, eval('tabpagenr()'))
|
||||
command('$tabmove')
|
||||
eq(10, eval('tabpagenr()'))
|
||||
command('tabmove 0')
|
||||
eq(1, eval('tabpagenr()'))
|
||||
command('tabmove $')
|
||||
eq(10, eval('tabpagenr()'))
|
||||
command('3tabmove')
|
||||
eq(4, eval('tabpagenr()'))
|
||||
command('7tabmove 5')
|
||||
eq(5, eval('tabpagenr()'))
|
||||
command('let a="No error caught."')
|
||||
eq('Vim(tabmove):E474: Invalid argument: tabmove foo',
|
||||
exc_exec('tabmove foo'))
|
||||
end)
|
||||
|
||||
it('can trigger certain autocommands', function()
|
||||
insert('Results:')
|
||||
|
||||
-- Test autocommands.
|
||||
source([[
|
||||
tabonly!
|
||||
let g:r=[]
|
||||
command -nargs=1 -bar C :call add(g:r, '=== '.<q-args>.' ===')|<args>
|
||||
function Test()
|
||||
autocmd TabEnter * :call add(g:r, 'TabEnter')
|
||||
autocmd WinEnter * :call add(g:r, 'WinEnter')
|
||||
autocmd BufEnter * :call add(g:r, 'BufEnter')
|
||||
autocmd TabLeave * :call add(g:r, 'TabLeave')
|
||||
autocmd WinLeave * :call add(g:r, 'WinLeave')
|
||||
autocmd BufLeave * :call add(g:r, 'BufLeave')
|
||||
let t:a='a'
|
||||
C tab split
|
||||
let t:a='b'
|
||||
C tabnew
|
||||
let t:a='c'
|
||||
call add(g:r, join(map(range(1, tabpagenr('$')),
|
||||
\ 'gettabvar(v:val, "a")')))
|
||||
C call map(range(1, tabpagenr('$')),
|
||||
\ 'settabvar(v:val, ''a'', v:val*2)')
|
||||
call add(g:r, join(map(range(1, tabpagenr('$')),
|
||||
\ 'gettabvar(v:val, "a")')))
|
||||
let w:a='a'
|
||||
C vsplit
|
||||
let w:a='a'
|
||||
let tabn=tabpagenr()
|
||||
let winr=range(1, winnr('$'))
|
||||
C tabnext 1
|
||||
call add(g:r, join(map(copy(winr),
|
||||
\ 'gettabwinvar('.tabn.', v:val, "a")')))
|
||||
C call map(copy(winr),
|
||||
\ 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)')
|
||||
call add(g:r, join(map(copy(winr),
|
||||
\ 'gettabwinvar('.tabn.', v:val, "a")')))
|
||||
augroup TabDestructive
|
||||
autocmd TabEnter * :C tabnext 2 | C tabclose 3
|
||||
augroup END
|
||||
C tabnext 3
|
||||
let g:r+=[tabpagenr().'/'.tabpagenr('$')]
|
||||
autocmd! TabDestructive TabEnter
|
||||
C tabnew
|
||||
C tabnext 1
|
||||
autocmd TabDestructive TabEnter * nested
|
||||
\ :C tabnext 2 | C tabclose 3
|
||||
C tabnext 2
|
||||
let g:r+=[tabpagenr().'/'.tabpagenr('$')]
|
||||
endfunction
|
||||
call Test()
|
||||
$ put =g:r
|
||||
]])
|
||||
|
||||
-- Assert buffer contents.
|
||||
expect([[
|
||||
Results:
|
||||
=== tab split ===
|
||||
WinLeave
|
||||
TabLeave
|
||||
WinEnter
|
||||
TabEnter
|
||||
=== tabnew ===
|
||||
WinLeave
|
||||
TabLeave
|
||||
WinEnter
|
||||
TabEnter
|
||||
BufLeave
|
||||
BufEnter
|
||||
a b c
|
||||
=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') ===
|
||||
2 4 6
|
||||
=== vsplit ===
|
||||
WinLeave
|
||||
WinEnter
|
||||
=== tabnext 1 ===
|
||||
BufLeave
|
||||
WinLeave
|
||||
TabLeave
|
||||
WinEnter
|
||||
TabEnter
|
||||
BufEnter
|
||||
a a
|
||||
=== call map(copy(winr), 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)') ===
|
||||
2 4
|
||||
=== tabnext 3 ===
|
||||
BufLeave
|
||||
WinLeave
|
||||
TabLeave
|
||||
WinEnter
|
||||
TabEnter
|
||||
=== tabnext 2 ===
|
||||
=== tabclose 3 ===
|
||||
2/2
|
||||
=== tabnew ===
|
||||
WinLeave
|
||||
TabLeave
|
||||
WinEnter
|
||||
TabEnter
|
||||
BufLeave
|
||||
BufEnter
|
||||
=== tabnext 1 ===
|
||||
BufLeave
|
||||
WinLeave
|
||||
TabLeave
|
||||
WinEnter
|
||||
TabEnter
|
||||
BufEnter
|
||||
=== tabnext 2 ===
|
||||
WinLeave
|
||||
TabLeave
|
||||
WinEnter
|
||||
TabEnter
|
||||
=== tabnext 2 ===
|
||||
=== tabclose 3 ===
|
||||
2/2]])
|
||||
eq(2, eval("tabpagenr('$')"))
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue
Block a user