From a1ed941a7881122fda2fd48e71e890ed55e4d08e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 3 Jan 2021 15:33:21 -0500 Subject: vim-patch:8.2.0861: cannot easily get all the current marks (#13676) Problem: Cannot easily get all the current marks. Solution: Add getmarklist(). (Yegappan Lakshmanan, closes #6032) https://github.com/vim/vim/commit/cfb4b47de08e4437c692d382067dc1692cd83c23 Cherry-pick the column number fix from patch v8.2.0871 because patch v8.2.0871 cannot be fully ported without the method patches. Co-authored-by: Peter Wolf --- src/nvim/testdir/test_marks.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_marks.vim b/src/nvim/testdir/test_marks.vim index 66df57ea39..e25fe33bb7 100644 --- a/src/nvim/testdir/test_marks.vim +++ b/src/nvim/testdir/test_marks.vim @@ -201,3 +201,28 @@ func Test_mark_error() call assert_fails('mark xx', 'E488:') call assert_fails('mark _', 'E191:') endfunc + +" Test for the getmarklist() function +func Test_getmarklist() + new + " global marks + delmarks A-Z 0-9 \" ^.[] + call assert_equal([], getmarklist()) + call setline(1, ['one', 'two', 'three']) + mark A + call cursor(3, 5) + normal mN + call assert_equal([{'file' : '', 'mark' : "'A", 'pos' : [bufnr(), 1, 1, 0]}, + \ {'file' : '', 'mark' : "'N", 'pos' : [bufnr(), 3, 5, 0]}], + \ getmarklist()) + " buffer local marks + delmarks! + call assert_equal([{'mark' : "''", 'pos' : [bufnr(), 1, 1, 0]}, + \ {'mark' : "'\"", 'pos' : [bufnr(), 1, 1, 0]}], getmarklist(bufnr())) + call cursor(2, 2) + normal mr + call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 2, 0]}, + \ getmarklist(bufnr())[0]) + call assert_equal([], getmarklist({})) + close! +endfunc -- cgit