forked from aniani/vim
patch 8.2.1888: Vim9: getbufline(-1, 1, '$') gives an error
Problem: Vim9: Getbufline(-1, 1, '$') gives an error. Solution: Return an empty list. (closes #7180)
This commit is contained in:
parent
15ab48f088
commit
e6e70a10f1
@ -717,17 +717,19 @@ get_buffer_lines(
|
|||||||
void
|
void
|
||||||
f_getbufline(typval_T *argvars, typval_T *rettv)
|
f_getbufline(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
linenr_T lnum;
|
linenr_T lnum = 1;
|
||||||
linenr_T end;
|
linenr_T end = 1;
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
|
|
||||||
buf = tv_get_buf_from_arg(&argvars[0]);
|
buf = tv_get_buf_from_arg(&argvars[0]);
|
||||||
|
if (buf != NULL)
|
||||||
lnum = tv_get_lnum_buf(&argvars[1], buf);
|
{
|
||||||
if (argvars[2].v_type == VAR_UNKNOWN)
|
lnum = tv_get_lnum_buf(&argvars[1], buf);
|
||||||
end = lnum;
|
if (argvars[2].v_type == VAR_UNKNOWN)
|
||||||
else
|
end = lnum;
|
||||||
end = tv_get_lnum_buf(&argvars[2], buf);
|
else
|
||||||
|
end = tv_get_lnum_buf(&argvars[2], buf);
|
||||||
|
}
|
||||||
|
|
||||||
get_buffer_lines(buf, lnum, end, TRUE, rettv);
|
get_buffer_lines(buf, lnum, end, TRUE, rettv);
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,8 @@ def Test_getbufline()
|
|||||||
var lines = ['aaa', 'bbb', 'ccc']
|
var lines = ['aaa', 'bbb', 'ccc']
|
||||||
setbufline(buf, 1, lines)
|
setbufline(buf, 1, lines)
|
||||||
getbufline('#', 1, '$')->assert_equal(lines)
|
getbufline('#', 1, '$')->assert_equal(lines)
|
||||||
|
getbufline(-1, '$', '$')->assert_equal([])
|
||||||
|
getbufline(-1, 1, '$')->assert_equal([])
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
enddef
|
enddef
|
||||||
|
@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
1888,
|
||||||
/**/
|
/**/
|
||||||
1887,
|
1887,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user