diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-20 11:13:17 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-20 11:13:17 +0000 |
commit | 228e422855d43965f2c3319ff0cdc26ea422c10f (patch) | |
tree | 81ae94babeb3a6f6f1145f8f87794bd97339ae98 /src/testdir | |
parent | 0a60f79fd0c328b47b36279a95282e9f8d9e7512 (diff) |
patch 9.0.0914: deletebufline() may move marks in the wrong windowv9.0.0914
Problem: deletebufline() may move marks in the wrong window.
Solution: Find a window for the buffer being changed. (closes #11583)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_bufline.vim | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/testdir/test_bufline.vim b/src/testdir/test_bufline.vim index da8c4a5aa2..6021a4ea80 100644 --- a/src/testdir/test_bufline.vim +++ b/src/testdir/test_bufline.vim @@ -98,12 +98,25 @@ func Test_appendbufline() new let b = bufnr('%') hide + + new + call setline(1, ['line1', 'line2', 'line3']) + normal! 2gggg + call assert_equal(2, line("''")) + 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)) + call assert_equal(0, appendbufline(b, 0, 'baz')) + call assert_equal(['baz', 'foo', 'bar'], getbufline(b, 1, 3)) + + " appendbufline() in a hidden buffer shouldn't move marks in current window. + call assert_equal(2, line("''")) + bwipe! + exe "bd!" b - call assert_equal([], getbufline(b, 1, 2)) + call assert_equal([], getbufline(b, 1, 3)) split Xtest call setline(1, ['a', 'b', 'c']) @@ -173,10 +186,21 @@ func Test_deletebufline() let b = bufnr('%') call setline(1, ['aaa', 'bbb', 'ccc']) hide + + new + call setline(1, ['line1', 'line2', 'line3']) + normal! 2gggg + call assert_equal(2, line("''")) + 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)) + + " deletebufline() in a hidden buffer shouldn't move marks in current window. + call assert_equal(2, line("''")) + bwipe! + exe "bd!" b call assert_equal(1, b->deletebufline(1)) |