From 9358979d096a6bfde371bbca5c77f8d45a4de253 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 22 Aug 2019 22:39:28 -0400 Subject: vim-patch:8.1.0037: cannot easily append lines to another buffer Problem: Cannot easily append lines to another buffer. Solution: Add appendbufline(). https://github.com/vim/vim/commit/ca851593a660f08aba5c134f90c238d4a3e983e6 --- src/nvim/testdir/test_bufline.vim | 27 ++++++++++++++++++++++++++- src/nvim/testdir/test_edit.vim | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_bufline.vim b/src/nvim/testdir/test_bufline.vim index b886e99506..b110c44eb1 100644 --- a/src/nvim/testdir/test_bufline.vim +++ b/src/nvim/testdir/test_bufline.vim @@ -1,4 +1,4 @@ -" Tests for setbufline() and getbufline() +" Tests for setbufline(), getbufline(), appendbufline() source shared.vim @@ -65,3 +65,28 @@ func Test_setline_startup() call delete('Xscript') call delete('Xtest') endfunc + +func Test_appendbufline() + new + let b = bufnr('%') + hide + call assert_equal(0, appendbufline(b, 0, ['foo', 'bar'])) + call assert_equal(['foo'], getbufline(b, 1)) + call assert_equal(['bar'], getbufline(b, 2)) + call assert_equal(['foo', 'bar'], getbufline(b, 1, 2)) + exe "bd!" b + call assert_equal([], getbufline(b, 1, 2)) + + split Xtest + call setline(1, ['a', 'b', 'c']) + let b = bufnr('%') + wincmd w + call assert_equal(1, appendbufline(b, 4, ['x'])) + call assert_equal(1, appendbufline(1234, 1, ['x'])) + call assert_equal(0, appendbufline(b, 3, ['d', 'e'])) + call assert_equal(['c'], getbufline(b, 3)) + call assert_equal(['d'], getbufline(b, 4)) + call assert_equal(['e'], getbufline(b, 5)) + call assert_equal([], getbufline(b, 6)) + exe "bwipe! " . b +endfunc diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index 827c54e704..1010ae4e09 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -537,7 +537,7 @@ func! Test_edit_CTRL_I() " Tab in completion mode let path=expand("%:p:h") new - call setline(1, [path."/", '']) + call setline(1, [path. "/", '']) call feedkeys("Arunt\\\\\", 'tnix') call assert_match('runtest\.vim', getline(1)) %d -- cgit From 7e6a2f2bedd47a2a2b3247977ef229c071225f81 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 22 Aug 2019 23:27:04 -0400 Subject: vim-patch:8.1.0039: cannot easily delete lines in another buffer Problem: Cannot easily delete lines in another buffer. Solution: Add deletebufline(). https://github.com/vim/vim/commit/d79a26219d7161e9211fd144f0e874aa5f6d251e --- src/nvim/testdir/test_bufline.vim | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_bufline.vim b/src/nvim/testdir/test_bufline.vim index b110c44eb1..1f83e8b776 100644 --- a/src/nvim/testdir/test_bufline.vim +++ b/src/nvim/testdir/test_bufline.vim @@ -1,4 +1,4 @@ -" Tests for setbufline(), getbufline(), appendbufline() +" Tests for setbufline(), getbufline(), appendbufline(), deletebufline() source shared.vim @@ -90,3 +90,25 @@ func Test_appendbufline() call assert_equal([], getbufline(b, 6)) exe "bwipe! " . b endfunc + +func Test_deletebufline() + new + let b = bufnr('%') + call setline(1, ['aaa', 'bbb', 'ccc']) + hide + call assert_equal(0, deletebufline(b, 2)) + call assert_equal(['aaa', 'ccc'], getbufline(b, 1, 2)) + call assert_equal(0, deletebufline(b, 2, 8)) + call assert_equal(['aaa'], getbufline(b, 1, 2)) + exe "bd!" b + call assert_equal(1, deletebufline(b, 1)) + + split Xtest + call setline(1, ['a', 'b', 'c']) + let b = bufnr('%') + wincmd w + call assert_equal(1, deletebufline(b, 4)) + call assert_equal(0, deletebufline(b, 1)) + call assert_equal(['b', 'c'], getbufline(b, 1, 2)) + exe "bwipe! " . b +endfunc -- cgit From c58054c231f11cfd911795b572029e9360835bbb Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 23 Aug 2019 07:24:02 -0400 Subject: vim-patch:8.0.1386: cannot select modified buffers with getbufinfo() Problem: Cannot select modified buffers with getbufinfo(). Solution: Add the "bufmodified" flag. (Yegappan Lakshmanan, closes vim/vim#2431) https://github.com/vim/vim/commit/8e6a31df81113bbf0e4bb5324a74dc5f6c62a490 --- src/nvim/testdir/test_bufwintabinfo.vim | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_bufwintabinfo.vim b/src/nvim/testdir/test_bufwintabinfo.vim index a6b4524cc0..d88b061ac7 100644 --- a/src/nvim/testdir/test_bufwintabinfo.vim +++ b/src/nvim/testdir/test_bufwintabinfo.vim @@ -20,6 +20,13 @@ function Test_getbufwintabinfo() call assert_equal('vim', l[0].variables.editor) call assert_notequal(-1, index(l[0].windows, bufwinid('%'))) + " Test for getbufinfo() with 'bufmodified' + call assert_equal(0, len(getbufinfo({'bufmodified' : 1}))) + call setbufline('Xtestfile1', 1, ["Line1"]) + let l = getbufinfo({'bufmodified' : 1}) + call assert_equal(1, len(l)) + call assert_equal(bufnr('Xtestfile1'), l[0].bufnr) + if has('signs') call append(0, ['Linux', 'Windows', 'Mac']) sign define Mark text=>> texthl=Search -- cgit From 2a1887c2df27c5f91f0f2f6ad6c70da60239cfce Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 23 Aug 2019 07:31:39 -0400 Subject: vim-patch:8.1.0187: getwininfo() and win_screenpos() return different numbers Problem: getwininfo() and win_screenpos() return different numbers. Solution: Add one to "wincol" and "winrow" from getwininfo(). https://github.com/vim/vim/commit/7132ddc1014a4e1230f0080e418221e5843e1277 --- src/nvim/testdir/test_bufwintabinfo.vim | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_bufwintabinfo.vim b/src/nvim/testdir/test_bufwintabinfo.vim index d88b061ac7..0e8c7d1dc1 100644 --- a/src/nvim/testdir/test_bufwintabinfo.vim +++ b/src/nvim/testdir/test_bufwintabinfo.vim @@ -52,21 +52,22 @@ function Test_getbufwintabinfo() let winlist = getwininfo() call assert_equal(5, len(winlist)) call assert_equal(winwidth(1), winlist[0].width) - call assert_equal(0, winlist[0].wincol) - let tablineheight = winlist[0].winrow == 1 ? 1 : 0 - call assert_equal(tablineheight, winlist[0].winrow) " tabline adds one + call assert_equal(1, winlist[0].wincol) + " tabline adds one row in terminal, not in GUI + let tablineheight = winlist[0].winrow == 2 ? 1 : 0 + call assert_equal(tablineheight + 1, winlist[0].winrow) call assert_equal(winbufnr(2), winlist[1].bufnr) call assert_equal(winheight(2), winlist[1].height) - call assert_equal(0, winlist[1].wincol) - call assert_equal(tablineheight + winheight(1) + 1, winlist[1].winrow) + call assert_equal(1, winlist[1].wincol) + call assert_equal(tablineheight + winheight(1) + 2, winlist[1].winrow) call assert_equal(1, winlist[2].winnr) - call assert_equal(tablineheight, winlist[2].winrow) - call assert_equal(0, winlist[2].wincol) + call assert_equal(tablineheight + 1, winlist[2].winrow) + call assert_equal(1, winlist[2].wincol) - call assert_equal(winlist[2].width + 1, winlist[3].wincol) - call assert_equal(0, winlist[4].wincol) + call assert_equal(winlist[2].width + 2, winlist[3].wincol) + call assert_equal(1, winlist[4].wincol) call assert_equal(1, winlist[0].tabnr) call assert_equal(1, winlist[1].tabnr) -- cgit