Mercurial > vim
comparison src/testdir/test_marks.vim @ 10730:44e9340dc604 v8.0.0255
patch 8.0.0255: setpos() does not use the buffer argument for all marks
commit https://github.com/vim/vim/commit/f13e00b2cf381e13fd327b5387a5bd6f004ac2a3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 28 18:23:54 2017 +0100
patch 8.0.0255: setpos() does not use the buffer argument for all marks
Problem: When calling setpos() with a buffer argument it often is ignored.
(Matthew Malcomson)
Solution: Make the buffer argument work for all marks local to a buffer.
(neovim #5713) Add more tests.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 28 Jan 2017 18:30:04 +0100 |
parents | c577c6a2e88b |
children | 3b600d16d9cb |
comparison
equal
deleted
inserted
replaced
10729:4441ce7a58f2 | 10730:44e9340dc604 |
---|---|
22 call assert_equal("AAA 123 123", getline(1)) | 22 call assert_equal("AAA 123 123", getline(1)) |
23 call assert_equal("123 XXXXXXX", getline(2)) | 23 call assert_equal("123 XXXXXXX", getline(2)) |
24 call assert_equal("XXX 123 123", getline(3)) | 24 call assert_equal("XXX 123 123", getline(3)) |
25 enew! | 25 enew! |
26 endfunction | 26 endfunction |
27 | |
28 func Test_setpos() | |
29 new one | |
30 let onebuf = bufnr('%') | |
31 let onewin = win_getid() | |
32 call setline(1, ['aaa', 'bbb', 'ccc']) | |
33 new two | |
34 let twobuf = bufnr('%') | |
35 let twowin = win_getid() | |
36 call setline(1, ['aaa', 'bbb', 'ccc']) | |
37 | |
38 " for the cursor the buffer number is ignored | |
39 call setpos(".", [0, 2, 1, 0]) | |
40 call assert_equal([0, 2, 1, 0], getpos(".")) | |
41 call setpos(".", [onebuf, 3, 3, 0]) | |
42 call assert_equal([0, 3, 3, 0], getpos(".")) | |
43 | |
44 call setpos("''", [0, 1, 3, 0]) | |
45 call assert_equal([0, 1, 3, 0], getpos("''")) | |
46 call setpos("''", [onebuf, 2, 2, 0]) | |
47 call assert_equal([0, 2, 2, 0], getpos("''")) | |
48 | |
49 " buffer-local marks | |
50 for mark in ["'a", "'\"", "'[", "']", "'<", "'>"] | |
51 call win_gotoid(twowin) | |
52 call setpos(mark, [0, 2, 1, 0]) | |
53 call assert_equal([0, 2, 1, 0], getpos(mark), "for mark " . mark) | |
54 call setpos(mark, [onebuf, 1, 3, 0]) | |
55 call win_gotoid(onewin) | |
56 call assert_equal([0, 1, 3, 0], getpos(mark), "for mark " . mark) | |
57 endfor | |
58 | |
59 " global marks | |
60 call win_gotoid(twowin) | |
61 call setpos("'N", [0, 2, 1, 0]) | |
62 call assert_equal([twobuf, 2, 1, 0], getpos("'N")) | |
63 call setpos("'N", [onebuf, 1, 3, 0]) | |
64 call assert_equal([onebuf, 1, 3, 0], getpos("'N")) | |
65 | |
66 call win_gotoid(onewin) | |
67 bwipe! | |
68 call win_gotoid(twowin) | |
69 bwipe! | |
70 endfunc |