comparison 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
comparison
equal deleted inserted replaced
20614:78caf677340d 20615:8eed1e9389bb
257 257
258 call delete('Xone') 258 call delete('Xone')
259 call delete('Xtwo') 259 call delete('Xtwo')
260 endfunc 260 endfunc
261 261
262 " Test for the getmarklist() function
263 func Test_getmarklist()
264 new
265 " global marks
266 delmarks A-Z 0-9 \" ^.[]
267 call assert_equal([], getmarklist())
268 call setline(1, ['one', 'two', 'three'])
269 mark A
270 call cursor(3, 5)
271 normal mN
272 call assert_equal([{'file' : '', 'mark' : "'A", 'pos' : [bufnr(), 1, 0, 0]},
273 \ {'file' : '', 'mark' : "'N", 'pos' : [bufnr(), 3, 4, 0]}],
274 \ getmarklist())
275 " buffer local marks
276 delmarks!
277 call assert_equal([{'mark' : "''", 'pos' : [bufnr(), 1, 0, 0]},
278 \ {'mark' : "'\"", 'pos' : [bufnr(), 1, 0, 0]}], getmarklist(bufnr()))
279 call cursor(2, 2)
280 normal mr
281 call assert_equal({'mark' : "'r", 'pos' : [bufnr(), 2, 1, 0]},
282 \ getmarklist(bufnr())[0])
283 call assert_equal([], getmarklist({}))
284 close!
285 endfunc
286
262 " vim: shiftwidth=2 sts=2 expandtab 287 " vim: shiftwidth=2 sts=2 expandtab