Mercurial > vim
changeset 13290:3f3d9ed211b2 v8.0.1519
patch 8.0.1519: getchangelist() does not use argument as bufname()
commit https://github.com/vim/vim/commit/341a64c9cabff08e4a7dc8cd932a598e12134457
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 13 19:21:17 2018 +0100
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 https://github.com/vim/vim/issues/2641)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 13 Feb 2018 19:30:06 +0100 |
parents | 36644af1322f |
children | a9ee06deb937 |
files | src/evalfunc.c src/testdir/test_changelist.vim src/version.c |
diffstat | 3 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4365,7 +4365,10 @@ f_getchangelist(typval_T *argvars, typva return; #ifdef FEAT_JUMPLIST - buf = find_buffer(&argvars[0]); + (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + ++emsg_off; + buf = get_buf_tv(&argvars[0], FALSE); + --emsg_off; if (buf == NULL) return;
--- a/src/testdir/test_changelist.vim +++ b/src/testdir/test_changelist.vim @@ -9,7 +9,7 @@ func Test_getchangelist() bwipe! enew call assert_equal([], getchangelist(10)) - call assert_equal([[], 0], getchangelist(bufnr('%'))) + call assert_equal([[], 0], getchangelist('%')) call writefile(['line1', 'line2', 'line3'], 'Xfile1.txt') call writefile(['line1', 'line2', 'line3'], 'Xfile2.txt') @@ -23,7 +23,7 @@ func Test_getchangelist() \ {'lnum' : 2, 'col' : 4, 'coladd' : 0}, \ {'lnum' : 4, 'col' : 4, 'coladd' : 0}, \ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 2], - \ getchangelist(bufnr('%'))) + \ getchangelist('%')) hide edit Xfile2.txt exe "normal 1GOline\<C-G>u1.0" @@ -31,7 +31,7 @@ func Test_getchangelist() call assert_equal([[ \ {'lnum' : 1, 'col' : 6, 'coladd' : 0}, \ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2], - \ getchangelist(bufnr('%'))) + \ getchangelist('%')) hide enew call assert_equal([[