mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.1.2049: Vim9: unexpected E1209 error
Problem: Vim9: unexpected E1209 error Solution: Fix error message (Hirohito Higashi) closes: #19067 Signed-off-by: Hirohito Higashi <h.east.727@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
997952a512
commit
4a9967bddf
+20
-12
@@ -6799,13 +6799,13 @@ var2fpos(
|
||||
char_u *name;
|
||||
static pos_T pos;
|
||||
pos_T *pp;
|
||||
int error = FALSE;
|
||||
|
||||
// Argument can be [lnum, col, coladd].
|
||||
if (varp->v_type == VAR_LIST)
|
||||
{
|
||||
list_T *l;
|
||||
int len;
|
||||
int error = FALSE;
|
||||
listitem_T *li;
|
||||
|
||||
l = varp->vval.v_list;
|
||||
@@ -6857,11 +6857,16 @@ var2fpos(
|
||||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
error = TRUE;
|
||||
pos.lnum = 0;
|
||||
if (name[0] == '.' && (!in_vim9script() || name[1] == NUL))
|
||||
if (name[0] == '.')
|
||||
{
|
||||
// cursor
|
||||
pos = curwin->w_cursor;
|
||||
if (!in_vim9script() || name[1] == NUL)
|
||||
{
|
||||
error = FALSE;
|
||||
// cursor
|
||||
pos = curwin->w_cursor;
|
||||
}
|
||||
}
|
||||
else if (name[0] == 'v' && name[1] == NUL)
|
||||
{
|
||||
@@ -6871,14 +6876,17 @@ var2fpos(
|
||||
else
|
||||
pos = curwin->w_cursor;
|
||||
}
|
||||
else if (name[0] == '\'' && (!in_vim9script()
|
||||
|| (name[1] != NUL && name[2] == NUL)))
|
||||
else if (name[0] == '\'')
|
||||
{
|
||||
// mark
|
||||
pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum);
|
||||
if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0)
|
||||
return NULL;
|
||||
pos = *pp;
|
||||
if (!in_vim9script() || (name[1] != NUL && name[2] == NUL))
|
||||
{
|
||||
error = FALSE;
|
||||
// mark
|
||||
pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum);
|
||||
if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0)
|
||||
return NULL;
|
||||
pos = *pp;
|
||||
}
|
||||
}
|
||||
if (pos.lnum != 0)
|
||||
{
|
||||
@@ -6929,7 +6937,7 @@ var2fpos(
|
||||
}
|
||||
return &pos;
|
||||
}
|
||||
if (in_vim9script())
|
||||
if (in_vim9script() && error)
|
||||
semsg(_(e_invalid_value_for_line_number_str), name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -804,6 +804,10 @@ def Test_col()
|
||||
v9.CheckSourceDefAndScriptFailure(['col(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1222: String or List required for argument 1'])
|
||||
v9.CheckSourceDefAndScriptFailure(['col(".", [])'], ['E1013: Argument 2: type mismatch, expected number but got list<any>', 'E1210: Number required for argument 2'])
|
||||
v9.CheckSourceDefExecAndScriptFailure(['col("")'], 'E1209: Invalid value for a line number')
|
||||
v9.CheckSourceDefExecAndScriptFailure(['col(".1")'], 'E1209: Invalid value for a line number')
|
||||
v9.CheckSourceDefAndScriptSuccess(['col(".")'])
|
||||
v9.CheckSourceDefExecAndScriptFailure(['col("\''a1")'], 'E1209: Invalid value for a line number')
|
||||
v9.CheckSourceDefAndScriptSuccess(['col("\''a")'])
|
||||
bw!
|
||||
enddef
|
||||
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2049,
|
||||
/**/
|
||||
2048,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user