Mercurial > vim
diff src/testdir/test_marks.vim @ 20615:8eed1e9389bb v8.2.0861
patch 8.2.0861: cannot easily get all the current marks
Commit: https://github.com/vim/vim/commit/cfb4b47de08e4437c692d382067dc1692cd83c23
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 31 15:41:57 2020 +0200
patch 8.2.0861: cannot easily get all the current marks
Problem: Cannot easily get all the current marks.
Solution: Add getmarklist(). (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6032)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 31 May 2020 15:45:04 +0200 |
parents | 0b42b5e50344 |
children | 3e36a51ff152 |
line wrap: on
line diff
--- a/src/testdir/test_marks.vim +++ b/src/testdir/test_marks.vim @@ -259,4 +259,29 @@ func Test_file_mark() call delete('Xtwo') 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, 0, 0]}, + \ {'file' : '', 'mark' : "'N", 'pos' : [bufnr(), 3, 4, 0]}], + \ getmarklist()) + " buffer local marks + delmarks! + call assert_equal([{'mark' : "''", 'pos' : [bufnr(), 1, 0, 0]}, + \ {'mark' : "'\"", 'pos' : [bufnr(), 1, 0, 0]}], getmarklist(bufnr())) + call cursor(2, 2) + normal mr + call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 1, 0]}, + \ getmarklist(bufnr())[0]) + call assert_equal([], getmarklist({})) + close! +endfunc + " vim: shiftwidth=2 sts=2 expandtab