forked from aniani/vim
patch 8.0.0663: unexpected error message only when 'verbose' is set
Problem: Giving an error message only when 'verbose' set is unexpected. Solution: Give a warning message instead.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*eval.txt* For Vim version 8.0. Last change: 2017 Jun 22
|
*eval.txt* For Vim version 8.0. Last change: 2017 Jun 23
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -5468,9 +5468,9 @@ line({expr}) The result is a Number, which is the line number of the file
|
|||||||
This autocommand jumps to the last known position in a file
|
This autocommand jumps to the last known position in a file
|
||||||
just after opening it, if the '" mark is set: >
|
just after opening it, if the '" mark is set: >
|
||||||
:au BufReadPost *
|
:au BufReadPost *
|
||||||
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
||||||
\ | exe "normal! g`\""
|
\ | exe "normal! g`\""
|
||||||
\ | endif
|
\ | endif
|
||||||
|
|
||||||
line2byte({lnum}) *line2byte()*
|
line2byte({lnum}) *line2byte()*
|
||||||
Return the byte count from the start of the buffer for line
|
Return the byte count from the start of the buffer for line
|
||||||
@@ -5892,7 +5892,7 @@ max({expr}) Return the maximum value of all items in {expr}.
|
|||||||
it returns the maximum of all values in the dictionary.
|
it returns the maximum of all values in the dictionary.
|
||||||
If {expr} is neither a list nor a dictionary, or one of the
|
If {expr} is neither a list nor a dictionary, or one of the
|
||||||
items in {expr} cannot be used as a Number this results in
|
items in {expr} cannot be used as a Number this results in
|
||||||
an error. An empty |List| or |Dictionary| results in zero.
|
an error. An empty |List| or |Dictionary| results in zero.
|
||||||
|
|
||||||
*min()*
|
*min()*
|
||||||
min({expr}) Return the minimum value of all items in {expr}.
|
min({expr}) Return the minimum value of all items in {expr}.
|
||||||
@@ -5900,7 +5900,7 @@ min({expr}) Return the minimum value of all items in {expr}.
|
|||||||
it returns the minimum of all values in the dictionary.
|
it returns the minimum of all values in the dictionary.
|
||||||
If {expr} is neither a list nor a dictionary, or one of the
|
If {expr} is neither a list nor a dictionary, or one of the
|
||||||
items in {expr} cannot be used as a Number this results in
|
items in {expr} cannot be used as a Number this results in
|
||||||
an error. An empty |List| or |Dictionary| results in zero.
|
an error. An empty |List| or |Dictionary| results in zero.
|
||||||
|
|
||||||
*mkdir()* *E739*
|
*mkdir()* *E739*
|
||||||
mkdir({name} [, {path} [, {prot}]])
|
mkdir({name} [, {path} [, {prot}]])
|
||||||
@@ -6195,8 +6195,8 @@ printf({fmt}, {expr1} ...) *printf()*
|
|||||||
zero the decimal point is omitted. When the precision
|
zero the decimal point is omitted. When the precision
|
||||||
is not specified 6 is used. A really big number
|
is not specified 6 is used. A really big number
|
||||||
(out of range or dividing by zero) results in "inf"
|
(out of range or dividing by zero) results in "inf"
|
||||||
or "-inf" with %f (INF or -INF with %F).
|
or "-inf" with %f (INF or -INF with %F).
|
||||||
"0.0 / 0.0" results in "nan" with %f (NAN with %F).
|
"0.0 / 0.0" results in "nan" with %f (NAN with %F).
|
||||||
Example: >
|
Example: >
|
||||||
echo printf("%.2f", 12.115)
|
echo printf("%.2f", 12.115)
|
||||||
< 12.12
|
< 12.12
|
||||||
@@ -8355,8 +8355,8 @@ winwidth({nr}) *winwidth()*
|
|||||||
:if winwidth(0) <= 50
|
:if winwidth(0) <= 50
|
||||||
: exe "normal 50\<C-W>|"
|
: exe "normal 50\<C-W>|"
|
||||||
:endif
|
:endif
|
||||||
< For getting the terminal or screen size, see the 'columns'
|
< For getting the terminal or screen size, see the 'columns'
|
||||||
option.
|
option.
|
||||||
|
|
||||||
|
|
||||||
wordcount() *wordcount()*
|
wordcount() *wordcount()*
|
||||||
@@ -8374,11 +8374,11 @@ wordcount() *wordcount()*
|
|||||||
cursor_words Number of words before cursor position
|
cursor_words Number of words before cursor position
|
||||||
(not in Visual mode)
|
(not in Visual mode)
|
||||||
visual_bytes Number of bytes visually selected
|
visual_bytes Number of bytes visually selected
|
||||||
(only in Visual mode)
|
(only in Visual mode)
|
||||||
visual_chars Number of chars visually selected
|
visual_chars Number of chars visually selected
|
||||||
(only in Visual mode)
|
(only in Visual mode)
|
||||||
visual_words Number of chars visually selected
|
visual_words Number of chars visually selected
|
||||||
(only in Visual mode)
|
(only in Visual mode)
|
||||||
|
|
||||||
|
|
||||||
*writefile()*
|
*writefile()*
|
||||||
@@ -8722,6 +8722,9 @@ See |:verbose-cmd| for more information.
|
|||||||
not used an error message is given. When [!] is used,
|
not used an error message is given. When [!] is used,
|
||||||
an existing function is silently replaced. Unless it
|
an existing function is silently replaced. Unless it
|
||||||
is currently being executed, that is an error.
|
is currently being executed, that is an error.
|
||||||
|
NOTE: Use ! wisely. If used without care it can cause
|
||||||
|
an existing function to be replaced unexpectedly,
|
||||||
|
which is hard to debug.
|
||||||
|
|
||||||
For the {arguments} see |function-argument|.
|
For the {arguments} see |function-argument|.
|
||||||
|
|
||||||
@@ -8771,7 +8774,7 @@ See |:verbose-cmd| for more information.
|
|||||||
implies that the effect of |:nohlsearch| is undone
|
implies that the effect of |:nohlsearch| is undone
|
||||||
when the function returns.
|
when the function returns.
|
||||||
|
|
||||||
*:endf* *:endfunction* *E126* *E193* *E946*
|
*:endf* *:endfunction* *E126* *E193* *W22*
|
||||||
:endf[unction] [argument]
|
:endf[unction] [argument]
|
||||||
The end of a function definition. Best is to put it
|
The end of a function definition. Best is to put it
|
||||||
on a line by its own, without [argument].
|
on a line by its own, without [argument].
|
||||||
@@ -8780,12 +8783,16 @@ See |:verbose-cmd| for more information.
|
|||||||
| command command to execute next
|
| command command to execute next
|
||||||
\n command command to execute next
|
\n command command to execute next
|
||||||
" comment always ignored
|
" comment always ignored
|
||||||
anything else ignored, unless 'verbose' is
|
anything else ignored, warning given when
|
||||||
non-zero
|
'verbose' is non-zero
|
||||||
The support for a following command was added in Vim
|
The support for a following command was added in Vim
|
||||||
8.0.0654, before that any argument was silently
|
8.0.0654, before that any argument was silently
|
||||||
ignored.
|
ignored.
|
||||||
|
|
||||||
|
To be able to define a function inside an `:execute`
|
||||||
|
command, use line breaks instead of |:bar|: >
|
||||||
|
:exe "func Foo()\necho 'foo'\nendfunc"
|
||||||
|
<
|
||||||
*:delf* *:delfunction* *E130* *E131* *E933*
|
*:delf* *:delfunction* *E130* *E131* *E933*
|
||||||
:delf[unction][!] {name}
|
:delf[unction][!] {name}
|
||||||
Delete function {name}.
|
Delete function {name}.
|
||||||
|
@@ -3471,6 +3471,13 @@ give_warning(char_u *message, int hl)
|
|||||||
--no_wait_return;
|
--no_wait_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
give_warning2(char_u *message, char_u *a1, int hl)
|
||||||
|
{
|
||||||
|
vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1);
|
||||||
|
give_warning(IObuff, hl);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Advance msg cursor to column "col".
|
* Advance msg cursor to column "col".
|
||||||
*/
|
*/
|
||||||
|
@@ -75,6 +75,7 @@ void verbose_leave_scroll(void);
|
|||||||
void verbose_stop(void);
|
void verbose_stop(void);
|
||||||
int verbose_open(void);
|
int verbose_open(void);
|
||||||
void give_warning(char_u *message, int hl);
|
void give_warning(char_u *message, int hl);
|
||||||
|
void give_warning2(char_u *message, char_u *a1, int hl);
|
||||||
void msg_advance(int col);
|
void msg_advance(int col);
|
||||||
int do_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd);
|
int do_dialog(int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield, int ex_cmd);
|
||||||
void display_confirm_msg(void);
|
void display_confirm_msg(void);
|
||||||
|
@@ -1381,10 +1381,12 @@ func Test_endfunction_trailing()
|
|||||||
|
|
||||||
set verbose=1
|
set verbose=1
|
||||||
exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
|
exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
|
||||||
|
call assert_notmatch('W22:', split(execute('1messages'), "\n")[0])
|
||||||
call assert_true(exists('*Xtest'))
|
call assert_true(exists('*Xtest'))
|
||||||
delfunc Xtest
|
delfunc Xtest
|
||||||
|
|
||||||
call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946')
|
exe "func Xtest()\necho 'hello'\nendfunc garbage"
|
||||||
|
call assert_match('W22:', split(execute('1messages'), "\n")[0])
|
||||||
call assert_true(exists('*Xtest'))
|
call assert_true(exists('*Xtest'))
|
||||||
delfunc Xtest
|
delfunc Xtest
|
||||||
set verbose=0
|
set verbose=0
|
||||||
|
@@ -2137,7 +2137,9 @@ ex_function(exarg_T *eap)
|
|||||||
/* Another command follows. */
|
/* Another command follows. */
|
||||||
eap->nextcmd = line_arg;
|
eap->nextcmd = line_arg;
|
||||||
else if (*p != NUL && *p != '"' && p_verbose > 0)
|
else if (*p != NUL && *p != '"' && p_verbose > 0)
|
||||||
EMSG2((char_u *)_("E946: Text found after :endfunction: %s"), p);
|
give_warning2(
|
||||||
|
(char_u *)_("W22: Text found after :endfunction: %s"),
|
||||||
|
p, TRUE);
|
||||||
if (line_arg == NULL)
|
if (line_arg == NULL)
|
||||||
vim_free(theline);
|
vim_free(theline);
|
||||||
break;
|
break;
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
663,
|
||||||
/**/
|
/**/
|
||||||
662,
|
662,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user