Skip to content

Commit 341a64c

Browse files
committed
patch 8.0.1519: getchangelist() does not use argument as bufname()
Problem: Getchangelist() does not use argument as bufname(). Solution: Use get_buf_tv(). (Yegappan Lakshmanan, closes #2641)
1 parent 2be5733 commit 341a64c

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/evalfunc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4365,7 +4365,10 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
43654365
return;
43664366

43674367
#ifdef FEAT_JUMPLIST
4368-
buf = find_buffer(&argvars[0]);
4368+
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
4369+
++emsg_off;
4370+
buf = get_buf_tv(&argvars[0], FALSE);
4371+
--emsg_off;
43694372
if (buf == NULL)
43704373
return;
43714374

src/testdir/test_changelist.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ func Test_getchangelist()
99
bwipe!
1010
enew
1111
call assert_equal([], getchangelist(10))
12-
call assert_equal([[], 0], getchangelist(bufnr('%')))
12+
call assert_equal([[], 0], getchangelist('%'))
1313

1414
call writefile(['line1', 'line2', 'line3'], 'Xfile1.txt')
1515
call writefile(['line1', 'line2', 'line3'], 'Xfile2.txt')
@@ -23,15 +23,15 @@ func Test_getchangelist()
2323
\ {'lnum' : 2, 'col' : 4, 'coladd' : 0},
2424
\ {'lnum' : 4, 'col' : 4, 'coladd' : 0},
2525
\ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 2],
26-
\ getchangelist(bufnr('%')))
26+
\ getchangelist('%'))
2727

2828
hide edit Xfile2.txt
2929
exe "normal 1GOline\<C-G>u1.0"
3030
exe "normal 2Goline\<C-G>u2.0"
3131
call assert_equal([[
3232
\ {'lnum' : 1, 'col' : 6, 'coladd' : 0},
3333
\ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2],
34-
\ getchangelist(bufnr('%')))
34+
\ getchangelist('%'))
3535
hide enew
3636

3737
call assert_equal([[

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,8 @@ static char *(features[]) =
771771

772772
static int included_patches[] =
773773
{ /* Add new patch number below this line */
774+
/**/
775+
1519,
774776
/**/
775777
1518,
776778
/**/

0 commit comments

Comments
 (0)