annotate src/testdir/test_signs.vim @ 21454:c50b04b76bc2

Added tag v8.2.1277 for changeset 40210bb08e3f3e696b33154b2ec02e1debb66e3c
author Bram Moolenaar <Bram@vim.org>
date Thu, 23 Jul 2020 15:00:05 +0200
parents 6a4806e326dd
children 08940efa6b4e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for signs
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature signs
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
6 source screendump.vim
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
7
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 func Test_sign()
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 new
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call setline(1, ['a', 'b', 'c', 'd'])
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
12 " Define some signs.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
13 " We can specify icons even if not all versions of vim support icons as
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
14 " icon is ignored when not supported. "(not supported)" is shown after
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
15 " the icon name when listing signs.
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 sign define Sign1 text=x
17807
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
17
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
18 call Sign_command_ignore_error('sign define Sign2 text=xy texthl=Title linehl=Error icon=../../pixmaps/stock_vim_find_help.png')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " Test listing signs.
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let a=execute('sign list')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
22 call assert_match('^\nsign Sign1 text=x \nsign Sign2 ' .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
23 \ 'icon=../../pixmaps/stock_vim_find_help.png .*text=xy ' .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
24 \ 'linehl=Error texthl=Title$', a)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 let a=execute('sign list Sign1')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal("\nsign Sign1 text=x ", a)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
29 " Split the window to the bottom to verify sign jump will stay in the
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
30 " current window if the buffer is displayed there.
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
31 let bn = bufnr('%')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
32 let wn = winnr()
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
33 exe 'sign place 41 line=3 name=Sign1 buffer=' . bn
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 1
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
35 bot split
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
36 exe 'sign jump 41 buffer=' . bufnr('%')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
37 call assert_equal('c', getline('.'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
38 call assert_equal(3, winnr())
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
39 call assert_equal(bn, bufnr('%'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
40 call assert_notequal(wn, winnr())
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
41
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
42 " Create a new buffer and check that ":sign jump" switches to the old buffer.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
43 1
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
44 new foo
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
45 call assert_notequal(bn, bufnr('%'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
46 exe 'sign jump 41 buffer=' . bn
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
47 call assert_equal(bn, bufnr('%'))
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call assert_equal('c', getline('.'))
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
50 " Redraw to make sure that screen redraw with sign gets exercised,
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
51 " with and without 'rightleft'.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
52 if has('rightleft')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
53 set rightleft
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
54 redraw
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
55 set norightleft
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
56 endif
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
57 redraw
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
59 " Check that we can't change sign.
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
60 call assert_fails("sign place 40 name=Sign1 buffer=" . bufnr('%'), 'E885:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
61
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
62 " Check placed signs
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 let a=execute('sign place')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
64 call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
65 \ " line=3 id=41 name=Sign1 priority=10\n", a)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
67 " Unplace the sign and try jumping to it again should fail.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
68 sign unplace 41
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 1
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
70 call assert_fails("sign jump 41 buffer=" . bufnr('%'), 'E157:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 call assert_equal('a', getline('.'))
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 " Unplace sign on current line.
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
74 exe 'sign place 42 line=4 name=Sign2 buffer=' . bufnr('%')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 4
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 sign unplace
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 let a=execute('sign place')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_equal("\n--- Signs ---\n", a)
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
79
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 " Try again to unplace sign on current line, it should fail this time.
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 call assert_fails('sign unplace', 'E159:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 " Unplace all signs.
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
84 exe 'sign place 41 line=3 name=Sign1 buffer=' . bufnr('%')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 sign unplace *
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 let a=execute('sign place')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal("\n--- Signs ---\n", a)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
89 " Place a sign without specifying the filename or buffer
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
90 sign place 77 line=9 name=Sign2
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
91 let a=execute('sign place')
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
92 call assert_equal("\n--- Signs ---\nSigns for [NULL]:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
93 \ " line=9 id=77 name=Sign2 priority=10\n", a)
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
94 sign unplace *
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
95
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
96 " Check :jump with file=...
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
97 edit foo
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
98 call setline(1, ['A', 'B', 'C', 'D'])
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
99
17807
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
100 call Sign_command_ignore_error('sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
101
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
102 let fn = expand('%:p')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
103 exe 'sign place 43 line=2 name=Sign3 file=' . fn
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
104 edit bar
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
105 call assert_notequal(fn, expand('%:p'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
106 exe 'sign jump 43 file=' . fn
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
107 call assert_equal('B', getline('.'))
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
108
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
109 " Check for jumping to a sign in a hidden buffer
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
110 enew! | only!
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
111 edit foo
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
112 call setline(1, ['A', 'B', 'C', 'D'])
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
113 let fn = expand('%:p')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
114 exe 'sign place 21 line=3 name=Sign3 file=' . fn
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
115 hide edit bar
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
116 exe 'sign jump 21 file=' . fn
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
117 call assert_equal('C', getline('.'))
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
118
15156
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
119 " can't define a sign with a non-printable character as text
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
120 call assert_fails("sign define Sign4 text=\e linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
121 call assert_fails("sign define Sign4 text=a\e linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
122 call assert_fails("sign define Sign4 text=\ea linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
123
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
124 " Only 1 or 2 character text is allowed
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
125 call assert_fails("sign define Sign4 text=abc linehl=Comment", 'E239:')
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
126 call assert_fails("sign define Sign4 text= linehl=Comment", 'E239:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
127 call assert_fails("sign define Sign4 text=\\ ab linehl=Comment", 'E239:')
15156
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
128
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
129 " define sign with whitespace
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
130 sign define Sign4 text=\ X linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
131 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
132 sign define Sign4 linehl=Comment text=\ X
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
133 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
134
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
135 sign define Sign5 text=X\ linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
136 sign undefine Sign5
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
137 sign define Sign5 linehl=Comment text=X\
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
138 sign undefine Sign5
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
139
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
140 " define sign with backslash
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
141 sign define Sign4 text=\\\\ linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
142 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
143 sign define Sign4 text=\\ linehl=Comment
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
144 sign undefine Sign4
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
145
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
146 " define a sign with a leading 0 in the name
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
147 sign unplace *
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
148 sign define 004 text=#> linehl=Comment
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
149 let a = execute('sign list 4')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
150 call assert_equal("\nsign 4 text=#> linehl=Comment", a)
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
151 exe 'sign place 20 line=3 name=004 buffer=' . bufnr('')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
152 let a = execute('sign place')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
153 call assert_equal("\n--- Signs ---\nSigns for foo:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
154 \ " line=3 id=20 name=4 priority=10\n", a)
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
155 exe 'sign unplace 20 buffer=' . bufnr('')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
156 sign undefine 004
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
157 call assert_fails('sign list 4', 'E155:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
158
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 " After undefining the sign, we should no longer be able to place it.
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 sign undefine Sign1
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 sign undefine Sign2
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
162 sign undefine Sign3
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
163 call assert_fails("sign place 41 line=3 name=Sign1 buffer=" .
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
164 \ bufnr('%'), 'E155:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
165 endfunc
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
167 " Undefining placed sign is not recommended.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
168 " Quoting :help sign
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
169 "
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
170 " :sign undefine {name}
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
171 " Deletes a previously defined sign. If signs with this {name}
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
172 " are still placed this will cause trouble.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
173 func Test_sign_undefine_still_placed()
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
174 new foobar
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
175 sign define Sign text=x
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
176 exe 'sign place 41 line=1 name=Sign buffer=' . bufnr('%')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
177 sign undefine Sign
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
178
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
179 " Listing placed sign should show that sign is deleted.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
180 let a=execute('sign place')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
181 call assert_equal("\n--- Signs ---\nSigns for foobar:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
182 \ " line=1 id=41 name=[Deleted] priority=10\n", a)
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
183
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
184 sign unplace 41
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
185 let a=execute('sign place')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
186 call assert_equal("\n--- Signs ---\n", a)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 endfunc
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 func Test_sign_completion()
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 sign define Sign1 text=x
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 sign define Sign2 text=y
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 call feedkeys(":sign \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 call assert_equal('"sign define jump list place undefine unplace', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 call feedkeys(":sign define Sign \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 call assert_equal('"sign define Sign icon= linehl= text= texthl=', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 call feedkeys(":sign define Sign linehl=Spell\<C-A>\<C-B>\"\<CR>", 'tx')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
200 call assert_equal('"sign define Sign linehl=SpellBad SpellCap ' .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
201 \ 'SpellLocal SpellRare', @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
203 call feedkeys(":sign define Sign texthl=Spell\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
204 call assert_equal('"sign define Sign texthl=SpellBad SpellCap ' .
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
205 \ 'SpellLocal SpellRare', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
206
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
207 call writefile(repeat(["Sun is shining"], 30), "XsignOne")
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
208 call writefile(repeat(["Sky is blue"], 30), "XsignTwo")
10044
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
209 call feedkeys(":sign define Sign icon=Xsig\<C-A>\<C-B>\"\<CR>", 'tx')
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
210 call assert_equal('"sign define Sign icon=XsignOne XsignTwo', @:)
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
211
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
212 " Test for completion of arguments to ':sign undefine'
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 call feedkeys(":sign undefine \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 call assert_equal('"sign undefine Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 call feedkeys(":sign place 1 \<C-A>\<C-B>\"\<CR>", 'tx')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
217 call assert_equal('"sign place 1 buffer= file= group= line= name= priority=',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
218 \ @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 call feedkeys(":sign place 1 name=\<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call assert_equal('"sign place 1 name=Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
223 edit XsignOne
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
224 sign place 1 name=Sign1 line=5
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
225 sign place 1 name=Sign1 group=g1 line=10
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
226 edit XsignTwo
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
227 sign place 1 name=Sign2 group=g2 line=15
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
228
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
229 " Test for completion of group= and file= arguments to ':sign place'
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
230 call feedkeys(":sign place 1 name=Sign1 file=Xsign\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
231 call assert_equal('"sign place 1 name=Sign1 file=XsignOne XsignTwo', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
232 call feedkeys(":sign place 1 name=Sign1 group=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
233 call assert_equal('"sign place 1 name=Sign1 group=g1 g2', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
234
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
235 " Test for completion of arguments to 'sign place' without sign identifier
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
236 call feedkeys(":sign place \<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
237 call assert_equal('"sign place buffer= file= group=', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
238 call feedkeys(":sign place file=Xsign\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
239 call assert_equal('"sign place file=XsignOne XsignTwo', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
240 call feedkeys(":sign place group=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
241 call assert_equal('"sign place group=g1 g2', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
242 call feedkeys(":sign place group=g1 file=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
243 call assert_equal('"sign place group=g1 file=XsignOne XsignTwo', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
244
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
245 " Test for completion of arguments to ':sign unplace'
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 call feedkeys(":sign unplace 1 \<C-A>\<C-B>\"\<CR>", 'tx')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
247 call assert_equal('"sign unplace 1 buffer= file= group=', @:)
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
248 call feedkeys(":sign unplace 1 file=Xsign\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
249 call assert_equal('"sign unplace 1 file=XsignOne XsignTwo', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
250 call feedkeys(":sign unplace 1 group=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
251 call assert_equal('"sign unplace 1 group=g1 g2', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
252 call feedkeys(":sign unplace 1 group=g2 file=Xsign\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
253 call assert_equal('"sign unplace 1 group=g2 file=XsignOne XsignTwo', @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
255 " Test for completion of arguments to ':sign list'
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 call feedkeys(":sign list \<C-A>\<C-B>\"\<CR>", 'tx')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 call assert_equal('"sign list Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
259 " Test for completion of arguments to ':sign jump'
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 call feedkeys(":sign jump 1 \<C-A>\<C-B>\"\<CR>", 'tx')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
261 call assert_equal('"sign jump 1 buffer= file= group=', @:)
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
262 call feedkeys(":sign jump 1 file=Xsign\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
263 call assert_equal('"sign jump 1 file=XsignOne XsignTwo', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
264 call feedkeys(":sign jump 1 group=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
265 call assert_equal('"sign jump 1 group=g1 g2', @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
267 " Error cases
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
268 call feedkeys(":sign here\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
269 call assert_equal('"sign here', @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
270 call feedkeys(":sign define Sign here=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
271 call assert_equal("\"sign define Sign here=\<C-A>", @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
272 call feedkeys(":sign place 1 here=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
273 call assert_equal("\"sign place 1 here=\<C-A>", @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
274 call feedkeys(":sign jump 1 here=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
275 call assert_equal("\"sign jump 1 here=\<C-A>", @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
276 call feedkeys(":sign here there\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
277 call assert_equal("\"sign here there\<C-A>", @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
278 call feedkeys(":sign here there=\<C-A>\<C-B>\"\<CR>", 'tx')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
279 call assert_equal("\"sign here there=\<C-A>", @:)
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
280
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
281 sign unplace * group=*
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 sign undefine Sign1
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 sign undefine Sign2
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
284 enew
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
285 call delete('XsignOne')
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
286 call delete('XsignTwo')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 endfunc
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 func Test_sign_invalid_commands()
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
290 sign define Sign1 text=x
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
291
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 call assert_fails('sign', 'E471:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
293 call assert_fails('sign jump', 'E471:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294 call assert_fails('sign xxx', 'E160:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 call assert_fails('sign define', 'E156:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
296 call assert_fails('sign define Sign1 xxx', 'E475:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 call assert_fails('sign undefine', 'E156:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 call assert_fails('sign list xxx', 'E155:')
12692
03a6aeea2096 patch 8.0.1224: still interference between test functions
Christian Brabandt <cb@256bit.org>
parents: 10044
diff changeset
299 call assert_fails('sign place 1 buffer=999', 'E158:')
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
300 call assert_fails('sign place 1 name=Sign1 buffer=999', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
301 call assert_fails('sign place buffer=999', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
302 call assert_fails('sign jump buffer=999', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
303 call assert_fails('sign jump 1 file=', 'E158:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
304 call assert_fails('sign jump 1 group=', 'E474:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
305 call assert_fails('sign jump 1 name=', 'E474:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
306 call assert_fails('sign jump 1 name=Sign1', 'E474:')
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
307 call assert_fails('sign jump 1 line=100', '474:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 call assert_fails('sign define Sign2 text=', 'E239:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
309 " Non-numeric identifier for :sign place
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
310 call assert_fails("sign place abc line=3 name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
311 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
312 " Non-numeric identifier for :sign unplace
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
313 call assert_fails("sign unplace abc name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
314 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
315 " Number followed by an alphabet as sign identifier for :sign place
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
316 call assert_fails("sign place 1abc line=3 name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
317 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
318 " Number followed by an alphabet as sign identifier for :sign unplace
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
319 call assert_fails("sign unplace 2abc name=Sign1 buffer=" . bufnr(''),
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
320 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
321 " Sign identifier and '*' for :sign unplace
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
322 call assert_fails("sign unplace 2 *", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
323 " Trailing characters after buffer number for :sign place
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
324 call assert_fails("sign place 1 line=3 name=Sign1 buffer=" .
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
325 \ bufnr('%') . 'xxx', 'E488:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
326 " Trailing characters after buffer number for :sign unplace
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
327 call assert_fails("sign unplace 1 buffer=" . bufnr('%') . 'xxx', 'E488:')
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
328 call assert_fails("sign unplace * buffer=" . bufnr('%') . 'xxx', 'E488:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
329 call assert_fails("sign unplace 1 xxx", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
330 call assert_fails("sign unplace * xxx", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
331 call assert_fails("sign unplace xxx", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
332 " Placing a sign without line number
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
333 call assert_fails("sign place name=Sign1 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
334 " Placing a sign without sign name
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
335 call assert_fails("sign place line=10 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
336 " Unplacing a sign with line number
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
337 call assert_fails("sign unplace 2 line=10 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
338 " Unplacing a sign with sign name
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
339 call assert_fails("sign unplace 2 name=Sign1 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
340 " Placing a sign without sign name
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
341 call assert_fails("sign place 2 line=3 buffer=" . bufnr('%'), 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
342 " Placing a sign with only sign identifier
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
343 call assert_fails("sign place 2", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
344 " Placing a sign with only a name
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
345 call assert_fails("sign place abc", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
346 " Placing a sign with only line number
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
347 call assert_fails("sign place 5 line=3", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
348 " Placing a sign with only sign group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
349 call assert_fails("sign place 5 group=g1", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
350 call assert_fails("sign place 5 group=*", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
351 " Placing a sign with only sign priority
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
352 call assert_fails("sign place 5 priority=10", 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
353
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
354 sign undefine Sign1
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355 endfunc
9902
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
356
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
357 func Test_sign_delete_buffer()
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
358 new
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
359 sign define Sign text=x
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
360 let bufnr = bufnr('%')
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
361 new
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
362 exe 'bd ' . bufnr
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
363 exe 'sign place 61 line=3 name=Sign buffer=' . bufnr
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
364 call assert_fails('sign jump 61 buffer=' . bufnr, 'E934:')
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
365 sign unplace 61
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
366 sign undefine Sign
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
367 endfunc
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
368
17807
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
369 " Ignore error: E255: Couldn't read in sign data!
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
370 " This error can happen when running in the GUI.
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
371 " Some gui like Motif do not support the png icon format.
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
372 func Sign_command_ignore_error(cmd)
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
373 try
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
374 exe a:cmd
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
375 catch /E255:/
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
376 endtry
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
377 endfunc
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
378
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
379 " ignore error: E255: Couldn't read in sign data!
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
380 " This error can happen when running in gui.
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
381 func Sign_define_ignore_error(name, attr)
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
382 try
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
383 call sign_define(a:name, a:attr)
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
384 catch /E255:/
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
385 endtry
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
386 endfunc
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
387
15271
a6319aca721b patch 8.1.0644: finding next sign ID is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15247
diff changeset
388 " Test for Vim script functions for managing signs
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
389 func Test_sign_funcs()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
390 " Remove all the signs
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
391 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
392 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
393
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
394 " Tests for sign_define()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
395 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
396 call assert_equal(0, "sign1"->sign_define(attr))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
397 call assert_equal([{'name' : 'sign1', 'texthl' : 'Error',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
398 \ 'linehl' : 'Search', 'text' : '=>'}], sign_getdefined())
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
399
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
400 " Define a new sign without attributes and then update it
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
401 call sign_define("sign2")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
402 let attr = {'text' : '!!', 'linehl' : 'DiffAdd', 'texthl' : 'DiffChange',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
403 \ 'icon' : 'sign2.ico'}
17807
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
404 call Sign_define_ignore_error("sign2", attr)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
405 call assert_equal([{'name' : 'sign2', 'texthl' : 'DiffChange',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
406 \ 'linehl' : 'DiffAdd', 'text' : '!!', 'icon' : 'sign2.ico'}],
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
407 \ "sign2"->sign_getdefined())
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
408
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
409 " Test for a sign name with digits
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
410 call assert_equal(0, sign_define(0002, {'linehl' : 'StatusLine'}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
411 call assert_equal([{'name' : '2', 'linehl' : 'StatusLine'}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
412 \ sign_getdefined(0002))
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
413 eval 0002->sign_undefine()
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
414
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
415 " Tests for invalid arguments to sign_define()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
416 call assert_fails('call sign_define("sign4", {"text" : "===>"})', 'E239:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
417 call assert_fails('call sign_define("sign5", {"text" : ""})', 'E239:')
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
418 call assert_fails('call sign_define({})', 'E731:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
419 call assert_fails('call sign_define("sign6", [])', 'E715:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
420
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
421 " Tests for sign_getdefined()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
422 call assert_equal([], sign_getdefined("none"))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
423 call assert_fails('call sign_getdefined({})', 'E731:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
424
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
425 " Tests for sign_place()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
426 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
427 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
428
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
429 call assert_equal(10, sign_place(10, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
430 \ {'lnum' : 20}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
431 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
432 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
433 \ 'priority' : 10}]}], sign_getplaced('Xsign'))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
434 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
435 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
436 \ 'priority' : 10}]}],
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
437 \ '%'->sign_getplaced({'lnum' : 20}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
438 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
439 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
440 \ 'priority' : 10}]}],
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
441 \ sign_getplaced('', {'id' : 10}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
442
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
443 " Tests for invalid arguments to sign_place()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
444 call assert_fails('call sign_place([], "", "mySign", 1)', 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
445 call assert_fails('call sign_place(5, "", "mySign", -1)', 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
446 call assert_fails('call sign_place(-1, "", "sign1", "Xsign", [])',
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
447 \ 'E715:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
448 call assert_fails('call sign_place(-1, "", "sign1", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
449 \ {"lnum" : 30})', 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
450 call assert_fails('call sign_place(10, "", "xsign1x", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
451 \ {"lnum" : 30})', 'E155:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
452 call assert_fails('call sign_place(10, "", "", "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
453 \ {"lnum" : 30})', 'E155:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
454 call assert_fails('call sign_place(10, "", [], "Xsign",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
455 \ {"lnum" : 30})', 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
456 call assert_fails('call sign_place(5, "", "sign1", "abcxyz.xxx",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
457 \ {"lnum" : 10})', 'E158:')
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
458 call assert_fails('call sign_place(5, "", "sign1", "@", {"lnum" : 10})',
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
459 \ 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
460 call assert_fails('call sign_place(5, "", "sign1", [], {"lnum" : 10})',
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
461 \ 'E730:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
462 call assert_fails('call sign_place(21, "", "sign1", "Xsign",
17805
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
463 \ {"lnum" : -1})', 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
464 call assert_fails('call sign_place(22, "", "sign1", "Xsign",
17805
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
465 \ {"lnum" : 0})', 'E474:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
466 call assert_fails('call sign_place(22, "", "sign1", "Xsign",
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
467 \ {"lnum" : []})', 'E745:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
468 call assert_equal(-1, sign_place(1, "*", "sign1", "Xsign", {"lnum" : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
469
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
470 " Tests for sign_getplaced()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
471 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
472 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
473 \ 'priority' : 10}]}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
474 \ sign_getplaced(bufnr('Xsign')))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
475 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
476 \ [{'id' : 10, 'group' : '', 'lnum' : 20, 'name' : 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
477 \ 'priority' : 10}]}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
478 \ sign_getplaced())
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
479 call assert_fails("call sign_getplaced('dummy.sign')", 'E158:')
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
480 call assert_fails('call sign_getplaced("&")', 'E158:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
481 call assert_fails('call sign_getplaced(-1)', 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
482 call assert_fails('call sign_getplaced("Xsign", [])', 'E715:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
483 call assert_equal([{'bufnr' : bufnr(''), 'signs' : []}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
484 \ sign_getplaced('Xsign', {'lnum' : 1000000}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
485 call assert_fails("call sign_getplaced('Xsign', {'lnum' : []})",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
486 \ 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
487 call assert_equal([{'bufnr' : bufnr(''), 'signs' : []}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
488 \ sign_getplaced('Xsign', {'id' : 44}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
489 call assert_fails("call sign_getplaced('Xsign', {'id' : []})",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
490 \ 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
491
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
492 " Tests for sign_unplace()
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
493 eval 20->sign_place('', 'sign2', 'Xsign', {"lnum" : 30})
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
494 call assert_equal(0, sign_unplace('',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
495 \ {'id' : 20, 'buffer' : 'Xsign'}))
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
496 call assert_equal(-1, ''->sign_unplace(
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
497 \ {'id' : 30, 'buffer' : 'Xsign'}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
498 call sign_place(20, '', 'sign2', 'Xsign', {"lnum" : 30})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
499 call assert_fails("call sign_unplace('',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
500 \ {'id' : 20, 'buffer' : 'buffer.c'})", 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
501 call assert_fails("call sign_unplace('',
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
502 \ {'id' : 20, 'buffer' : '&'})", 'E158:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
503 call assert_fails("call sign_unplace('g1',
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
504 \ {'id' : 20, 'buffer' : 200})", 'E158:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
505 call assert_fails("call sign_unplace('g1', 'mySign')", 'E715:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
506
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
507 call sign_unplace('*')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
508
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
509 " Test for modifying a placed sign
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
510 call assert_equal(15, sign_place(15, '', 'sign1', 'Xsign', {'lnum' : 20}))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
511 call assert_equal(15, sign_place(15, '', 'sign2', 'Xsign'))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
512 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
513 \ [{'id' : 15, 'group' : '', 'lnum' : 20, 'name' : 'sign2',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
514 \ 'priority' : 10}]}],
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
515 \ sign_getplaced())
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
516
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
517 " Tests for sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
518 call assert_equal(0, sign_undefine("sign1"))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
519 call assert_equal([], sign_getdefined("sign1"))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
520 call assert_fails('call sign_undefine("none")', 'E155:')
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
521 call assert_fails('call sign_undefine({})', 'E731:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
522
17805
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
523 " Test for using '.' as the line number for sign_place()
17807
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
524 call Sign_define_ignore_error("sign1", attr)
17805
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
525 call cursor(22, 1)
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
526 call assert_equal(15, sign_place(15, '', 'sign1', 'Xsign',
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
527 \ {'lnum' : '.'}))
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
528 call assert_equal([{'bufnr' : bufnr(''), 'signs' :
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
529 \ [{'id' : 15, 'group' : '', 'lnum' : 22, 'name' : 'sign1',
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
530 \ 'priority' : 10}]}],
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
531 \ sign_getplaced('%', {'lnum' : 22}))
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
532
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
533 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
534 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
535 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
536 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
537 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
538
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
539 " Tests for sign groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
540 func Test_sign_group()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
541 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
542 " Remove all the signs
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
543 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
544 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
545
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
546 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
547
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
548 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
549 call assert_equal(0, sign_define("sign1", attr))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
550
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
551 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
552 let bnum = bufnr('%')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
553
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
554 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
555 call assert_fails("call sign_place(5, [], 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
556 \ {'lnum' : 30})", 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
557
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
558 " place three signs with the same identifier. One in the global group and
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
559 " others in the named groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
560 call assert_equal(5, sign_place(5, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
561 \ {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
562 call assert_equal(5, sign_place(5, 'g1', 'sign1', bnum, {'lnum' : 20}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
563 call assert_equal(5, sign_place(5, 'g2', 'sign1', bnum, {'lnum' : 30}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
564
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
565 " Test for sign_getplaced() with group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
566 let s = sign_getplaced('Xsign')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
567 call assert_equal(1, len(s[0].signs))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
568 call assert_equal(s[0].signs[0].group, '')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
569 let s = sign_getplaced(bnum, {'group' : ''})
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
570 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
571 \ 'priority' : 10}], s[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
572 call assert_equal(1, len(s[0].signs))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
573 let s = sign_getplaced(bnum, {'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
574 call assert_equal('g2', s[0].signs[0].group)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
575 let s = sign_getplaced(bnum, {'group' : 'g3'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
576 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
577 let s = sign_getplaced(bnum, {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
578 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
579 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
580 \ {'id' : 5, 'group' : 'g1', 'name' : 'sign1', 'lnum' : 20,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
581 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
582 \ {'id' : 5, 'group' : 'g2', 'name' : 'sign1', 'lnum' : 30,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
583 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
584 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
585
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
586 " Test for sign_getplaced() with id
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
587 let s = sign_getplaced(bnum, {'id' : 5})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
588 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
589 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
590 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
591 let s = sign_getplaced(bnum, {'id' : 5, 'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
592 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
593 \ [{'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
594 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
595 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
596 let s = sign_getplaced(bnum, {'id' : 5, 'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
597 call assert_equal([{'id' : 5, 'group' : '', 'name' : 'sign1', 'lnum' : 10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
598 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
599 \ {'id' : 5, 'group' : 'g1', 'name' : 'sign1', 'lnum' : 20,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
600 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
601 \ {'id' : 5, 'group' : 'g2', 'name' : 'sign1', 'lnum' : 30,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
602 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
603 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
604 let s = sign_getplaced(bnum, {'id' : 5, 'group' : 'g3'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
605 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
606
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
607 " Test for sign_getplaced() with lnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
608 let s = sign_getplaced(bnum, {'lnum' : 20})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
609 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
610 let s = sign_getplaced(bnum, {'lnum' : 20, 'group' : 'g1'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
611 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
612 \ [{'id' : 5, 'name' : 'sign1', 'lnum' : 20, 'group' : 'g1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
613 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
614 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
615 let s = sign_getplaced(bnum, {'lnum' : 30, 'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
616 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
617 \ [{'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
618 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
619 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
620 let s = sign_getplaced(bnum, {'lnum' : 40, 'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
621 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
622
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
623 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
624 call assert_fails("call sign_getplaced(bnum, {'group' : []})",
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
625 \ 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
626
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
627 " Clear the sign in global group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
628 call sign_unplace('', {'id' : 5, 'buffer' : bnum})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
629 let s = sign_getplaced(bnum, {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
630 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
631 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 20, 'group' : 'g1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
632 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
633 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
634 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
635 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
636
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
637 " Clear the sign in one of the groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
638 call sign_unplace('g1', {'buffer' : 'Xsign'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
639 let s = sign_getplaced(bnum, {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
640 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
641 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 30, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
642 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
643 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
644
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
645 " Clear all the signs from the buffer
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
646 call sign_unplace('*', {'buffer' : bnum})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
647 call assert_equal([], sign_getplaced(bnum, {'group' : '*'})[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
648
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
649 " Clear sign across groups using an identifier
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
650 call sign_place(25, '', 'sign1', bnum, {'lnum' : 10})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
651 call sign_place(25, 'g1', 'sign1', bnum, {'lnum' : 11})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
652 call sign_place(25, 'g2', 'sign1', bnum, {'lnum' : 12})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
653 call assert_equal(0, sign_unplace('*', {'id' : 25}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
654 call assert_equal([], sign_getplaced(bnum, {'group' : '*'})[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
655
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
656 " Error case
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
657 call assert_fails("call sign_unplace({})", 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
658
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
659 " Place a sign in the global group and try to delete it using a group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
660 call assert_equal(5, sign_place(5, '', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
661 call assert_equal(-1, sign_unplace('g1', {'id' : 5}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
662
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
663 " Place signs in multiple groups and delete all the signs in one of the
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
664 " group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
665 call assert_equal(5, sign_place(5, '', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
666 call assert_equal(6, sign_place(6, '', 'sign1', bnum, {'lnum' : 11}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
667 call assert_equal(5, sign_place(5, 'g1', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
668 call assert_equal(5, sign_place(5, 'g2', 'sign1', bnum, {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
669 call assert_equal(6, sign_place(6, 'g1', 'sign1', bnum, {'lnum' : 11}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
670 call assert_equal(6, sign_place(6, 'g2', 'sign1', bnum, {'lnum' : 11}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
671 call assert_equal(0, sign_unplace('g1'))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
672 let s = sign_getplaced(bnum, {'group' : 'g1'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
673 call assert_equal([], s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
674 let s = sign_getplaced(bnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
675 call assert_equal(2, len(s[0].signs))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
676 let s = sign_getplaced(bnum, {'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
677 call assert_equal('g2', s[0].signs[0].group)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
678 call assert_equal(0, sign_unplace('', {'id' : 5}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
679 call assert_equal(0, sign_unplace('', {'id' : 6}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
680 let s = sign_getplaced(bnum, {'group' : 'g2'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
681 call assert_equal('g2', s[0].signs[0].group)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
682 call assert_equal(0, sign_unplace('', {'buffer' : bnum}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
683
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
684 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
685
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
686 " Test for :sign command and groups
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
687 sign place 5 line=10 name=sign1 file=Xsign
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
688 sign place 5 group=g1 line=10 name=sign1 file=Xsign
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
689 sign place 5 group=g2 line=10 name=sign1 file=Xsign
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
690
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
691 " Tests for the ':sign place' command
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
692
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
693 " :sign place file={fname}
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
694 let a = execute('sign place file=Xsign')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
695 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
696 \ " line=10 id=5 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
697
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
698 " :sign place group={group} file={fname}
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
699 let a = execute('sign place group=g2 file=Xsign')
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
700 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
701 \ " line=10 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
702
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
703 " :sign place group=* file={fname}
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
704 let a = execute('sign place group=* file=Xsign')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
705 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
706 \ " line=10 id=5 group=g2 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
707 \ " line=10 id=5 group=g1 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
708 \ " line=10 id=5 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
709
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
710 " Error case: non-existing group
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
711 let a = execute('sign place group=xyz file=Xsign')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
712 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
713
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
714 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
715 let bnum = bufnr('Xsign')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
716 exe 'sign place 5 line=10 name=sign1 buffer=' . bnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
717 exe 'sign place 5 group=g1 line=11 name=sign1 buffer=' . bnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
718 exe 'sign place 5 group=g2 line=12 name=sign1 buffer=' . bnum
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
719
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
720 " :sign place buffer={fname}
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
721 let a = execute('sign place buffer=' . bnum)
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
722 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
723 \ " line=10 id=5 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
724
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
725 " :sign place group={group} buffer={fname}
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
726 let a = execute('sign place group=g2 buffer=' . bnum)
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
727 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
728 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
729
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
730 " :sign place group=* buffer={fname}
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
731 let a = execute('sign place group=* buffer=' . bnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
732 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
733 \ " line=10 id=5 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
734 \ " line=11 id=5 group=g1 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
735 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
736
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
737 " Error case: non-existing group
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
738 let a = execute('sign place group=xyz buffer=' . bnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
739 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n", a)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
740
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
741 " :sign place
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
742 let a = execute('sign place')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
743 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
744 \ " line=10 id=5 name=sign1 priority=10\n", a)
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
745
15388
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
746 " Place signs in more than one buffer and list the signs
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
747 split foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
748 set buftype=nofile
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
749 sign place 25 line=76 name=sign1 priority=99 file=foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
750 let a = execute('sign place')
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
751 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
752 \ " line=10 id=5 name=sign1 priority=10\n" .
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
753 \ "Signs for foo:\n" .
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
754 \ " line=76 id=25 name=sign1 priority=99\n", a)
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
755 close
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
756 bwipe foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
757
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
758 " :sign place group={group}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
759 let a = execute('sign place group=g1')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
760 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
761 \ " line=11 id=5 group=g1 name=sign1 priority=10\n", a)
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
762
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
763 " :sign place group=*
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
764 let a = execute('sign place group=*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
765 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
766 \ " line=10 id=5 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
767 \ " line=11 id=5 group=g1 name=sign1 priority=10\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
768 \ " line=12 id=5 group=g2 name=sign1 priority=10\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
769
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
770 " Test for ':sign jump' command with groups
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
771 sign jump 5 group=g1 file=Xsign
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
772 call assert_equal(11, line('.'))
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
773 call assert_equal('Xsign', bufname(''))
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
774 sign jump 5 group=g2 file=Xsign
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
775 call assert_equal(12, line('.'))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
776
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
777 " Test for :sign jump command without the filename or buffer
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
778 sign jump 5
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
779 call assert_equal(10, line('.'))
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
780 sign jump 5 group=g1
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
781 call assert_equal(11, line('.'))
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
782
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
783 " Error cases
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
784 call assert_fails("sign place 3 group= name=sign1 buffer=" . bnum, 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
785
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
786 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
787 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
788 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
789 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
790 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
791
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
792 " Place signs used for ":sign unplace" command test
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
793 func Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
794 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
795
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
796 sign place 3 line=10 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
797 sign place 3 group=g1 line=11 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
798 sign place 3 group=g2 line=12 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
799 sign place 4 line=15 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
800 sign place 4 group=g1 line=16 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
801 sign place 4 group=g2 line=17 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
802 sign place 5 line=20 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
803 sign place 5 group=g1 line=21 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
804 sign place 5 group=g2 line=22 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
805 sign place 6 line=25 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
806 sign place 6 group=g1 line=26 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
807 sign place 6 group=g2 line=27 name=sign1 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
808 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
809
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
810 " Place multiple signs in a single line for test
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
811 func Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
812 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
813 sign place 3 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
814 sign place 3 group=g1 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
815 sign place 3 group=g2 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
816 sign place 4 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
817 sign place 4 group=g1 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
818 sign place 4 group=g2 line=13 name=sign1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
819 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
820
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
821 " Tests for the ':sign unplace' command
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
822 func Test_sign_unplace()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
823 enew | only
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
824 " Remove all the signs
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
825 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
826 call sign_undefine()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
827
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
828 " Create two files and define signs
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
829 call writefile(repeat(["Sun is shining"], 30), "Xsign1")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
830 call writefile(repeat(["It is beautiful"], 30), "Xsign2")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
831
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
832 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
833 call sign_define("sign1", attr)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
834
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
835 edit Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
836 let bnum1 = bufnr('%')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
837 split Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
838 let bnum2 = bufnr('%')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
839
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
840 let signs1 = [{'id' : 3, 'name' : 'sign1', 'lnum' : 10, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
841 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
842 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 11, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
843 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
844 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 12, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
845 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
846 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 15, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
847 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
848 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 16, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
849 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
850 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 17, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
851 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
852 let signs2 = [{'id' : 5, 'name' : 'sign1', 'lnum' : 20, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
853 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
854 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 21, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
855 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
856 \ {'id' : 5, 'name' : 'sign1', 'lnum' : 22, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
857 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
858 \ {'id' : 6, 'name' : 'sign1', 'lnum' : 25, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
859 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
860 \ {'id' : 6, 'name' : 'sign1', 'lnum' : 26, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
861 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
862 \ {'id' : 6, 'name' : 'sign1', 'lnum' : 27, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
863 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
864
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
865 " Test for :sign unplace {id} file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
866 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
867 sign unplace 3 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
868 sign unplace 6 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
869 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
870 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
871 \ {idx, val -> val.id != 3 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
872 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
873 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
874 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
875 \ {idx, val -> val.id != 6 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
876 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
877
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
878 " Test for :sign unplace {id} group={group} file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
879 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
880 sign unplace 4 group=g1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
881 sign unplace 5 group=g2 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
882 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
883 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
884 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
885 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
886 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
887 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
888 \ {idx, val -> val.id != 5 || val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
889 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
890
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
891 " Test for :sign unplace {id} group=* file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
892 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
893 sign unplace 3 group=* file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
894 sign unplace 6 group=* file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
895 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
896 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
897 \ {idx, val -> val.id != 3}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
898 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
899 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
900 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
901 \ {idx, val -> val.id != 6}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
902 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
903
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
904 " Test for :sign unplace * file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
905 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
906 sign unplace * file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
907 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
908 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
909 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
910 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
911 call assert_equal(signs2, sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
912
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
913 " Test for :sign unplace * group={group} file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
914 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
915 sign unplace * group=g1 file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
916 sign unplace * group=g2 file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
917 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
918 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
919 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
920 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
921 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
922 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
923 \ {idx, val -> val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
924 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
925
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
926 " Test for :sign unplace * group=* file={fname}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
927 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
928 sign unplace * group=* file=Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
929 call assert_equal(signs1, sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
930 call assert_equal([], sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
931
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
932 " Test for :sign unplace {id} buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
933 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
934 exe 'sign unplace 3 buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
935 exe 'sign unplace 6 buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
936 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
937 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
938 \ {idx, val -> val.id != 3 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
939 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
940 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
941 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
942 \ {idx, val -> val.id != 6 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
943 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
944
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
945 " Test for :sign unplace {id} group={group} buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
946 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
947 exe 'sign unplace 4 group=g1 buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
948 exe 'sign unplace 5 group=g2 buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
949 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
950 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
951 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
952 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
953 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
954 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
955 \ {idx, val -> val.id != 5 || val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
956 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
957
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
958 " Test for :sign unplace {id} group=* buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
959 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
960 exe 'sign unplace 3 group=* buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
961 exe 'sign unplace 6 group=* buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
962 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
963 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
964 \ {idx, val -> val.id != 3}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
965 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
966 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
967 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
968 \ {idx, val -> val.id != 6}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
969 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
970
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
971 " Test for :sign unplace * buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
972 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
973 exe 'sign unplace * buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
974 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
975 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
976 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
977 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
978 call assert_equal(signs2, sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
979
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
980 " Test for :sign unplace * group={group} buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
981 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
982 exe 'sign unplace * group=g1 buffer=' . bnum1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
983 exe 'sign unplace * group=g2 buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
984 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
985 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
986 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
987 \ sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
988 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
989 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
990 \ {idx, val -> val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
991 \ sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
992
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
993 " Test for :sign unplace * group=* buffer={nr}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
994 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
995 exe 'sign unplace * group=* buffer=' . bnum2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
996 call assert_equal(signs1, sign_getplaced(bnum1, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
997 call assert_equal([], sign_getplaced(bnum2, {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
998
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
999 " Test for :sign unplace {id}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1000 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1001 sign unplace 4
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1002 sign unplace 6
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1003 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1004 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1005 \ {idx, val -> val.id != 4 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1006 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1007 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1008 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1009 \ {idx, val -> val.id != 6 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1010 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1011
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1012 " Test for :sign unplace {id} group={group}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1013 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1014 sign unplace 4 group=g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1015 sign unplace 6 group=g2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1016 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1017 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1018 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1019 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1020 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1021 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1022 \ {idx, val -> val.id != 6 || val.group != 'g2'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1023 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1024
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1025 " Test for :sign unplace {id} group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1026 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1027 sign unplace 3 group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1028 sign unplace 5 group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1029 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1030 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1031 \ {idx, val -> val.id != 3}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1032 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1033 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1034 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1035 \ {idx, val -> val.id != 5}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1036 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1037
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1038 " Test for :sign unplace *
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1039 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1040 sign unplace *
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1041 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1042 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1043 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1044 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1045 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1046 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1047 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1048 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1049
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1050 " Test for :sign unplace * group={group}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1051 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1052 sign unplace * group=g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1053 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1054 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1055 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1056 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1057 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1058 \ filter(copy(signs2),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1059 \ {idx, val -> val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1060 \ sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1061
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1062 " Test for :sign unplace * group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1063 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1064 sign unplace * group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1065 call assert_equal([], sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1066 call assert_equal([], sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1067
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1068 " Negative test cases
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1069 call Place_signs_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1070 sign unplace 3 group=xy file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1071 sign unplace * group=xy file=Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1072 silent! sign unplace * group=* file=FileNotPresent
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1073 call assert_equal(signs1, sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1074 call assert_equal(signs2, sign_getplaced('Xsign2', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1075
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1076 " Tests for removing sign at the current cursor position
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1077
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1078 " Test for ':sign unplace'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1079 let signs1 = [{'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1080 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1081 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1082 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1083 \ {'id' : 4, 'name' : 'sign1', 'lnum' : 13, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1084 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1085 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g2',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1086 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1087 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : 'g1',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1088 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1089 \ {'id' : 3, 'name' : 'sign1', 'lnum' : 13, 'group' : '',
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1090 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1091 exe bufwinnr('Xsign1') . 'wincmd w'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1092 call cursor(13, 1)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1093
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1094 " Should remove only one sign in the global group
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1095 call Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1096 sign unplace
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1097 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1098 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1099 \ {idx, val -> val.id != 4 || val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1100 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1101 " Should remove the second sign in the global group
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1102 sign unplace
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1103 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1104 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1105 \ {idx, val -> val.group != ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1106 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1107
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1108 " Test for ':sign unplace group={group}'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1109 call Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1110 " Should remove only one sign in group g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1111 sign unplace group=g1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1112 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1113 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1114 \ {idx, val -> val.id != 4 || val.group != 'g1'}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1115 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1116 sign unplace group=g2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1117 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1118 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1119 \ {idx, val -> val.id != 4 || val.group == ''}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1120 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1121
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1122 " Test for ':sign unplace group=*'
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1123 call Place_signs_at_line_for_test()
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1124 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1125 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1126 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1127 call assert_equal(
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1128 \ filter(copy(signs1),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1129 \ {idx, val -> val.id != 4}),
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1130 \ sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1131 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1132 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1133 sign unplace group=*
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1134 call assert_equal([], sign_getplaced('Xsign1', {'group' : '*'})[0].signs)
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1135
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1136 call sign_unplace('*')
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1137 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1138 enew | only
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1139 call delete("Xsign1")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1140 call delete("Xsign2")
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1141 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1142
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1143 " Tests for auto-generating the sign identifier.
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1144 func Test_aaa_sign_id_autogen()
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1145 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1146 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1147 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1148
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1149 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1150 call assert_equal(0, sign_define("sign1", attr))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1151
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1152 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1153 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1154
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1155 call assert_equal(1, sign_place(0, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1156 \ {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1157 call assert_equal(2, sign_place(2, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1158 \ {'lnum' : 12}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1159 call assert_equal(3, sign_place(0, '', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1160 \ {'lnum' : 14}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1161 call sign_unplace('', {'buffer' : 'Xsign', 'id' : 2})
15271
a6319aca721b patch 8.1.0644: finding next sign ID is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15247
diff changeset
1162 call assert_equal(4, sign_place(0, '', 'sign1', 'Xsign',
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1163 \ {'lnum' : 12}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1164
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1165 call assert_equal(1, sign_place(0, 'g1', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1166 \ {'lnum' : 11}))
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1167 " Check for the next generated sign id in this group
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1168 call assert_equal(2, sign_place(0, 'g1', 'sign1', 'Xsign',
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1169 \ {'lnum' : 12}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1170 call assert_equal(0, sign_unplace('g1', {'id' : 1}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1171 call assert_equal(10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1172 \ sign_getplaced('Xsign', {'id' : 1})[0].signs[0].lnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1173
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1174 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1175 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1176 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1177 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1178 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1179
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1180 " Test for sign priority
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1181 func Test_sign_priority()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1182 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1183 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1184 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1185
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1186 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Search'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1187 call sign_define("sign1", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1188 call sign_define("sign2", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1189 call sign_define("sign3", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1190
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1191 " Place three signs with different priority in the same line
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1192 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1193 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1194
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1195 call sign_place(1, 'g1', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1196 \ {'lnum' : 11, 'priority' : 50})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1197 call sign_place(2, 'g2', 'sign2', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1198 \ {'lnum' : 11, 'priority' : 100})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1199 call sign_place(3, '', 'sign3', 'Xsign', {'lnum' : 11})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1200 let s = sign_getplaced('Xsign', {'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1201 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1202 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 11, 'group' : 'g2',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1203 \ 'priority' : 100},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1204 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 11, 'group' : 'g1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1205 \ 'priority' : 50},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1206 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 11, 'group' : '',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1207 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1208 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1209
16978
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1210 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1211
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1212 " Three signs on different lines with changing priorities
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1213 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1214 \ {'lnum' : 11, 'priority' : 50})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1215 call sign_place(2, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1216 \ {'lnum' : 12, 'priority' : 60})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1217 call sign_place(3, '', 'sign3', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1218 \ {'lnum' : 13, 'priority' : 70})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1219 call sign_place(2, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1220 \ {'lnum' : 12, 'priority' : 40})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1221 call sign_place(3, '', 'sign3', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1222 \ {'lnum' : 13, 'priority' : 30})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1223 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1224 \ {'lnum' : 11, 'priority' : 50})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1225 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1226 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1227 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 11, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1228 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1229 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 12, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1230 \ 'priority' : 40},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1231 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 13, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1232 \ 'priority' : 30}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1233 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1234
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1235 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1236
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1237 " Two signs on the same line with changing priorities
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1238 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1239 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1240 call sign_place(2, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1241 \ {'lnum' : 4, 'priority' : 30})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1242 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1243 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1244 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1245 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1246 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1247 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1248 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1249 " Change the priority of the last sign to highest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1250 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1251 \ {'lnum' : 4, 'priority' : 40})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1252 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1253 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1254 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1255 \ 'priority' : 40},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1256 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1257 \ 'priority' : 30}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1258 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1259 " Change the priority of the first sign to lowest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1260 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1261 \ {'lnum' : 4, 'priority' : 25})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1262 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1263 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1264 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1265 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1266 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1267 \ 'priority' : 25}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1268 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1269 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1270 \ {'lnum' : 4, 'priority' : 45})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1271 call sign_place(2, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1272 \ {'lnum' : 4, 'priority' : 55})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1273 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1274 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1275 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1276 \ 'priority' : 55},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1277 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1278 \ 'priority' : 45}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1279 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1280
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1281 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1282
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1283 " Three signs on the same line with changing priorities
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1284 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1285 \ {'lnum' : 4, 'priority' : 40})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1286 call sign_place(2, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1287 \ {'lnum' : 4, 'priority' : 30})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1288 call sign_place(3, '', 'sign3', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1289 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1290 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1291 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1292 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1293 \ 'priority' : 40},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1294 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1295 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1296 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1297 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1298 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1299
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1300 " Change the priority of the middle sign to the highest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1301 call sign_place(2, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1302 \ {'lnum' : 4, 'priority' : 50})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1303 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1304 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1305 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1306 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1307 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1308 \ 'priority' : 40},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1309 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1310 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1311 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1312
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1313 " Change the priority of the middle sign to the lowest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1314 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1315 \ {'lnum' : 4, 'priority' : 15})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1316 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1317 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1318 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1319 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1320 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1321 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1322 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1323 \ 'priority' : 15}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1324 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1325
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1326 " Change the priority of the last sign to the highest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1327 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1328 \ {'lnum' : 4, 'priority' : 55})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1329 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1330 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1331 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1332 \ 'priority' : 55},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1333 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1334 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1335 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1336 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1337 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1338
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1339 " Change the priority of the first sign to the lowest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1340 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1341 \ {'lnum' : 4, 'priority' : 15})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1342 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1343 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1344 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1345 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1346 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1347 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1348 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1349 \ 'priority' : 15}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1350 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1351
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1352 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1353
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1354 " Three signs on the same line with changing priorities along with other
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1355 " signs
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1356 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1357 \ {'lnum' : 2, 'priority' : 10})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1358 call sign_place(2, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1359 \ {'lnum' : 4, 'priority' : 30})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1360 call sign_place(3, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1361 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1362 call sign_place(4, '', 'sign3', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1363 \ {'lnum' : 4, 'priority' : 25})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1364 call sign_place(5, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1365 \ {'lnum' : 6, 'priority' : 80})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1366 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1367 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1368 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 2, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1369 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1370 \ {'id' : 2, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1371 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1372 \ {'id' : 4, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1373 \ 'priority' : 25},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1374 \ {'id' : 3, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1375 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1376 \ {'id' : 5, 'name' : 'sign2', 'lnum' : 6, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1377 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1378 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1379
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1380 " Change the priority of the first sign to lowest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1381 call sign_place(2, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1382 \ {'lnum' : 4, 'priority' : 15})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1383 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1384 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1385 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 2, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1386 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1387 \ {'id' : 4, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1388 \ 'priority' : 25},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1389 \ {'id' : 3, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1390 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1391 \ {'id' : 2, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1392 \ 'priority' : 15},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1393 \ {'id' : 5, 'name' : 'sign2', 'lnum' : 6, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1394 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1395 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1396
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1397 " Change the priority of the last sign to highest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1398 call sign_place(2, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1399 \ {'lnum' : 4, 'priority' : 30})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1400 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1401 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1402 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 2, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1403 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1404 \ {'id' : 2, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1405 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1406 \ {'id' : 4, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1407 \ 'priority' : 25},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1408 \ {'id' : 3, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1409 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1410 \ {'id' : 5, 'name' : 'sign2', 'lnum' : 6, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1411 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1412 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1413
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1414 " Change the priority of the middle sign to lowest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1415 call sign_place(4, '', 'sign3', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1416 \ {'lnum' : 4, 'priority' : 15})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1417 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1418 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1419 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 2, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1420 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1421 \ {'id' : 2, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1422 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1423 \ {'id' : 3, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1424 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1425 \ {'id' : 4, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1426 \ 'priority' : 15},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1427 \ {'id' : 5, 'name' : 'sign2', 'lnum' : 6, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1428 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1429 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1430
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1431 " Change the priority of the middle sign to highest
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1432 call sign_place(3, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1433 \ {'lnum' : 4, 'priority' : 35})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1434 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1435 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1436 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 2, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1437 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1438 \ {'id' : 3, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1439 \ 'priority' : 35},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1440 \ {'id' : 2, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1441 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1442 \ {'id' : 4, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1443 \ 'priority' : 15},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1444 \ {'id' : 5, 'name' : 'sign2', 'lnum' : 6, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1445 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1446 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1447
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1448 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1449
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1450 " Multiple signs with the same priority on the same line
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1451 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1452 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1453 call sign_place(2, '', 'sign2', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1454 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1455 call sign_place(3, '', 'sign3', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1456 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1457 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1458 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1459 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1460 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1461 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1462 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1463 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1464 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1465 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1466 " Place the last sign again with the same priority
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1467 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1468 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1469 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1470 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1471 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1472 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1473 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1474 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1475 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1476 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1477 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1478 " Place the first sign again with the same priority
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1479 call sign_place(1, '', 'sign1', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1480 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1481 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1482 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1483 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1484 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1485 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1486 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1487 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1488 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1489 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1490 " Place the middle sign again with the same priority
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1491 call sign_place(3, '', 'sign3', 'Xsign',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1492 \ {'lnum' : 4, 'priority' : 20})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1493 let s = sign_getplaced('Xsign', {'group' : '*'})
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1494 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1495 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1496 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1497 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1498 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1499 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 4, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1500 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1501 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1502
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1503 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1504
16930
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1505 " Place multiple signs with same id on a line with different priority
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1506 call sign_place(1, '', 'sign1', 'Xsign',
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1507 \ {'lnum' : 5, 'priority' : 20})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1508 call sign_place(1, '', 'sign2', 'Xsign',
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1509 \ {'lnum' : 5, 'priority' : 10})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1510 let s = sign_getplaced('Xsign', {'lnum' : 5})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1511 call assert_equal([
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1512 \ {'id' : 1, 'name' : 'sign2', 'lnum' : 5, 'group' : '',
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1513 \ 'priority' : 10}],
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1514 \ s[0].signs)
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1515 call sign_place(1, '', 'sign2', 'Xsign',
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1516 \ {'lnum' : 5, 'priority' : 5})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1517 let s = sign_getplaced('Xsign', {'lnum' : 5})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1518 call assert_equal([
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1519 \ {'id' : 1, 'name' : 'sign2', 'lnum' : 5, 'group' : '',
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1520 \ 'priority' : 5}],
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1521 \ s[0].signs)
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1522
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1523 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1524 call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1525 \ [])", 'E715:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1526 call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1527 \ {'priority' : []})", 'E745:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1528 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1529
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1530 " Tests for the :sign place command with priority
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1531 sign place 5 line=10 name=sign1 priority=30 file=Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1532 sign place 5 group=g1 line=10 name=sign1 priority=20 file=Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1533 sign place 5 group=g2 line=10 name=sign1 priority=25 file=Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1534 let a = execute('sign place group=*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1535 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1536 \ " line=10 id=5 name=sign1 priority=30\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1537 \ " line=10 id=5 group=g2 name=sign1 priority=25\n" .
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1538 \ " line=10 id=5 group=g1 name=sign1 priority=20\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1539
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1540 " Test for :sign place group={group}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1541 let a = execute('sign place group=g1')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1542 call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
15386
317846db300a patch 8.1.0701: sign message not translated and inconsistent spacing
Bram Moolenaar <Bram@vim.org>
parents: 15378
diff changeset
1543 \ " line=10 id=5 group=g1 name=sign1 priority=20\n", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1544
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1545 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1546 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1547 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1548 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1549 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1550
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1551 " Tests for memory allocation failures in sign functions
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1552 func Test_sign_memfailures()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1553 call writefile(repeat(["Sun is shining"], 30), "Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1554 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1555
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1556 call test_alloc_fail(GetAllocId('sign_getdefined'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1557 call assert_fails('call sign_getdefined("sign1")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1558 call test_alloc_fail(GetAllocId('sign_getplaced'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1559 call assert_fails('call sign_getplaced("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1560 call test_alloc_fail(GetAllocId('sign_define_by_name'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1561 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1562 call assert_fails('call sign_define("sign1", attr)', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1563
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1564 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error'}
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1565 call sign_define("sign1", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1566 call test_alloc_fail(GetAllocId('sign_getlist'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1567 call assert_fails('call sign_getdefined("sign1")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1568
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1569 call sign_place(3, 'g1', 'sign1', 'Xsign', {'lnum' : 10})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1570 call test_alloc_fail(GetAllocId('sign_getplaced_dict'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1571 call assert_fails('call sign_getplaced("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1572 call test_alloc_fail(GetAllocId('sign_getplaced_list'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1573 call assert_fails('call sign_getplaced("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1574
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1575 call test_alloc_fail(GetAllocId('insert_sign'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1576 call assert_fails('call sign_place(4, "g1", "sign1", "Xsign", {"lnum" : 11})',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1577 \ 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1578
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1579 call test_alloc_fail(GetAllocId('sign_getinfo'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1580 call assert_fails('call getbufinfo()', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1581 call sign_place(4, 'g1', 'sign1', 'Xsign', {'lnum' : 11})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1582 call test_alloc_fail(GetAllocId('sign_getinfo'), 0, 0)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1583 call assert_fails('let binfo=getbufinfo("Xsign")', 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1584 call assert_equal([{'lnum': 11, 'id': 4, 'name': 'sign1',
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1585 \ 'priority': 10, 'group': 'g1'}], binfo[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1586
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1587 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1588 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1589 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1590 call delete("Xsign")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1591 endfunc
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1592
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1593 " Test for auto-adjusting the line number of a placed sign.
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1594 func Test_sign_lnum_adjust()
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1595 enew! | only!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1596
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1597 sign define sign1 text=#> linehl=Comment
15519
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1598 call setline(1, ['A', 'B', 'C', 'D', 'E'])
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1599 exe 'sign place 5 line=3 name=sign1 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1600 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1601 call assert_equal(3, l[0].signs[0].lnum)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1602
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1603 " Add some lines before the sign and check the sign line number
15519
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1604 call append(2, ['BA', 'BB', 'BC'])
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1605 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1606 call assert_equal(6, l[0].signs[0].lnum)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1607
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1608 " Delete some lines before the sign and check the sign line number
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1609 call deletebufline('%', 1, 2)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1610 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1611 call assert_equal(4, l[0].signs[0].lnum)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1612
15519
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1613 " Insert some lines after the sign and check the sign line number
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1614 call append(5, ['DA', 'DB'])
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1615 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1616 call assert_equal(4, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1617
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1618 " Delete some lines after the sign and check the sign line number
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1619 call deletebufline('', 6, 7)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1620 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1621 call assert_equal(4, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1622
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1623 " Break the undo. Otherwise the undo operation below will undo all the
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1624 " changes made by this function.
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1625 let &undolevels=&undolevels
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1626
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1627 " Delete the line with the sign
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1628 call deletebufline('', 4)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1629 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1630 call assert_equal(4, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1631
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1632 " Undo the delete operation
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1633 undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1634 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1635 call assert_equal(5, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1636
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1637 " Break the undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1638 let &undolevels=&undolevels
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1639
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1640 " Delete few lines at the end of the buffer including the line with the sign
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1641 " Sign line number should not change (as it is placed outside of the buffer)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1642 call deletebufline('', 3, 6)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1643 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1644 call assert_equal(5, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1645
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1646 " Undo the delete operation. Sign should be restored to the previous line
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1647 undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1648 let l = sign_getplaced(bufnr(''))
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1649 call assert_equal(5, l[0].signs[0].lnum)
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1650
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1651 sign unplace * group=*
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1652 sign undefine sign1
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1653 enew!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1654 endfunc
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1655
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1656 " Test for changing the type of a placed sign
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1657 func Test_sign_change_type()
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1658 enew! | only!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1659
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1660 sign define sign1 text=#> linehl=Comment
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1661 sign define sign2 text=@@ linehl=Comment
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1662
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1663 call setline(1, ['A', 'B', 'C', 'D'])
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1664 exe 'sign place 4 line=3 name=sign1 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1665 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1666 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1667 exe 'sign place 4 name=sign2 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1668 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1669 call assert_equal('sign2', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1670 call sign_place(4, '', 'sign1', '')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1671 let l = sign_getplaced(bufnr(''))
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1672 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1673
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1674 exe 'sign place 4 group=g1 line=4 name=sign1 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1675 let l = sign_getplaced(bufnr(''), {'group' : 'g1'})
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1676 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1677 exe 'sign place 4 group=g1 name=sign2 buffer=' . bufnr('')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1678 let l = sign_getplaced(bufnr(''), {'group' : 'g1'})
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1679 call assert_equal('sign2', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1680 call sign_place(4, 'g1', 'sign1', '')
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1681 let l = sign_getplaced(bufnr(''), {'group' : 'g1'})
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1682 call assert_equal('sign1', l[0].signs[0].name)
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1683
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1684 sign unplace * group=*
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1685 sign undefine sign1
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1686 sign undefine sign2
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1687 enew!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1688 endfunc
15418
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1689
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1690 " Test for the sign_jump() function
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1691 func Test_sign_jump_func()
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1692 enew! | only!
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1693
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1694 sign define sign1 text=#> linehl=Comment
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1695
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1696 edit foo
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1697 set buftype=nofile
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1698 call setline(1, ['A', 'B', 'C', 'D', 'E'])
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1699 call sign_place(5, '', 'sign1', '', {'lnum' : 2})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1700 call sign_place(5, 'g1', 'sign1', '', {'lnum' : 3})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1701 call sign_place(6, '', 'sign1', '', {'lnum' : 4})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1702 call sign_place(6, 'g1', 'sign1', '', {'lnum' : 5})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1703 split bar
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1704 set buftype=nofile
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1705 call setline(1, ['P', 'Q', 'R', 'S', 'T'])
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1706 call sign_place(5, '', 'sign1', '', {'lnum' : 2})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1707 call sign_place(5, 'g1', 'sign1', '', {'lnum' : 3})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1708 call sign_place(6, '', 'sign1', '', {'lnum' : 4})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1709 call sign_place(6, 'g1', 'sign1', '', {'lnum' : 5})
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1710
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1711 let r = sign_jump(5, '', 'foo')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1712 call assert_equal(2, r)
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1713 call assert_equal(2, line('.'))
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
1714 let r = 6->sign_jump('g1', 'foo')
15418
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1715 call assert_equal(5, r)
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1716 call assert_equal(5, line('.'))
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1717 let r = sign_jump(5, '', 'bar')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1718 call assert_equal(2, r)
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1719 call assert_equal(2, line('.'))
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1720
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1721 " Error cases
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1722 call assert_fails("call sign_jump(99, '', 'bar')", 'E157:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1723 call assert_fails("call sign_jump(0, '', 'foo')", 'E474:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1724 call assert_fails("call sign_jump(5, 'g5', 'foo')", 'E157:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1725 call assert_fails('call sign_jump([], "", "foo")', 'E745:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1726 call assert_fails('call sign_jump(2, [], "foo")', 'E730:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20625
diff changeset
1727 call assert_fails('call sign_jump(2, "", {})', 'E731:')
15418
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1728 call assert_fails('call sign_jump(2, "", "baz")', 'E158:')
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1729
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1730 sign unplace * group=*
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1731 sign undefine sign1
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1732 enew! | only!
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1733 endfunc
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1734
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1735 " Test for correct cursor position after the sign column appears or disappears.
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1736 func Test_sign_cursor_position()
20625
116c7bd5e980 patch 8.2.0866: not enough tests for buffer writing
Bram Moolenaar <Bram@vim.org>
parents: 19447
diff changeset
1737 CheckRunVimInTerminal
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1738
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1739 let lines =<< trim END
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1740 call setline(1, [repeat('x', 75), 'mmmm', 'yyyy'])
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1741 call cursor(2,1)
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1742 sign define s1 texthl=Search text==>
19447
5b82f041dbbb patch 8.2.0281: two placed signs in the same line are not combined
Bram Moolenaar <Bram@vim.org>
parents: 19095
diff changeset
1743 sign define s2 linehl=Pmenu
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1744 redraw
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1745 sign place 10 line=2 name=s1
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1746 END
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1747 call writefile(lines, 'XtestSigncolumn')
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1748 let buf = RunVimInTerminal('-S XtestSigncolumn', {'rows': 6})
19095
5cd0986ab02e patch 8.2.0108: when sign text is changed a manual redraw is needed
Bram Moolenaar <Bram@vim.org>
parents: 17998
diff changeset
1749 call VerifyScreenDump(buf, 'Test_sign_cursor_1', {})
5cd0986ab02e patch 8.2.0108: when sign text is changed a manual redraw is needed
Bram Moolenaar <Bram@vim.org>
parents: 17998
diff changeset
1750
5cd0986ab02e patch 8.2.0108: when sign text is changed a manual redraw is needed
Bram Moolenaar <Bram@vim.org>
parents: 17998
diff changeset
1751 " Change the sign text
5cd0986ab02e patch 8.2.0108: when sign text is changed a manual redraw is needed
Bram Moolenaar <Bram@vim.org>
parents: 17998
diff changeset
1752 call term_sendkeys(buf, ":sign define s1 text=-)\<CR>")
5cd0986ab02e patch 8.2.0108: when sign text is changed a manual redraw is needed
Bram Moolenaar <Bram@vim.org>
parents: 17998
diff changeset
1753 call VerifyScreenDump(buf, 'Test_sign_cursor_2', {})
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1754
19447
5b82f041dbbb patch 8.2.0281: two placed signs in the same line are not combined
Bram Moolenaar <Bram@vim.org>
parents: 19095
diff changeset
1755 " Also place a line HL sign
5b82f041dbbb patch 8.2.0281: two placed signs in the same line are not combined
Bram Moolenaar <Bram@vim.org>
parents: 19095
diff changeset
1756 call term_sendkeys(buf, ":sign place 11 line=2 name=s2\<CR>")
5b82f041dbbb patch 8.2.0281: two placed signs in the same line are not combined
Bram Moolenaar <Bram@vim.org>
parents: 19095
diff changeset
1757 call VerifyScreenDump(buf, 'Test_sign_cursor_3', {})
5b82f041dbbb patch 8.2.0281: two placed signs in the same line are not combined
Bram Moolenaar <Bram@vim.org>
parents: 19095
diff changeset
1758
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1759 " update cursor position calculation
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1760 call term_sendkeys(buf, "lh")
19447
5b82f041dbbb patch 8.2.0281: two placed signs in the same line are not combined
Bram Moolenaar <Bram@vim.org>
parents: 19095
diff changeset
1761 call term_sendkeys(buf, ":sign unplace 11\<CR>")
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1762 call term_sendkeys(buf, ":sign unplace 10\<CR>")
19447
5b82f041dbbb patch 8.2.0281: two placed signs in the same line are not combined
Bram Moolenaar <Bram@vim.org>
parents: 19095
diff changeset
1763 call VerifyScreenDump(buf, 'Test_sign_cursor_4', {})
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1764
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1765 " clean up
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1766 call StopVimInTerminal(buf)
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1767 call delete('XtestSigncolumn')
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1768 endfunc
17129
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1769
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1770 " Return the 'len' characters in screen starting from (row,col)
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1771 func s:ScreenLine(row, col, len)
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1772 let s = ''
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1773 for i in range(a:len)
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1774 let s .= nr2char(screenchar(a:row, a:col + i))
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1775 endfor
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1776 return s
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1777 endfunc
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1778
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1779 " Test for 'signcolumn' set to 'number'.
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1780 func Test_sign_numcol()
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1781 new
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1782 call append(0, "01234")
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1783 " With 'signcolumn' set to 'number', make sure sign is displayed in the
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1784 " number column and line number is not displayed.
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1785 set numberwidth=2
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1786 set number
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1787 set signcolumn=number
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1788 sign define sign1 text==>
17427
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1789 sign define sign2 text=V
17129
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1790 sign place 10 line=1 name=sign1
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1791 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1792 call assert_equal("=> 01234", s:ScreenLine(1, 1, 8))
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1793
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1794 " With 'signcolumn' set to 'number', when there is no sign, make sure line
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1795 " number is displayed in the number column
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1796 sign unplace 10
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1797 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1798 call assert_equal("1 01234", s:ScreenLine(1, 1, 7))
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1799
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1800 " Disable number column. Check whether sign is displayed in the sign column
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1801 set numberwidth=4
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1802 set nonumber
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1803 sign place 10 line=1 name=sign1
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1804 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1805 call assert_equal("=>01234", s:ScreenLine(1, 1, 7))
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1806
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1807 " Enable number column. Check whether sign is displayed in the number column
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1808 set number
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1809 redraw!
17141
3c0efdd95f8d patch 8.1.1570: icon signs not displayed properly in the number column
Bram Moolenaar <Bram@vim.org>
parents: 17129
diff changeset
1810 call assert_equal(" => 01234", s:ScreenLine(1, 1, 9))
17129
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1811
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1812 " Disable sign column. Make sure line number is displayed
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1813 set signcolumn=no
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1814 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1815 call assert_equal(" 1 01234", s:ScreenLine(1, 1, 9))
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1816
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1817 " Enable auto sign column. Make sure both sign and line number are displayed
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1818 set signcolumn=auto
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1819 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1820 call assert_equal("=> 1 01234", s:ScreenLine(1, 1, 11))
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1821
17247
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1822 " Test displaying signs in the number column with width 1
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1823 call sign_unplace('*')
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1824 call append(1, "abcde")
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1825 call append(2, "01234")
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1826 " Enable number column with width 1
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1827 set number numberwidth=1 signcolumn=auto
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1828 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1829 call assert_equal("3 01234", s:ScreenLine(3, 1, 7))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1830 " Place a sign and make sure number column width remains the same
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1831 sign place 20 line=2 name=sign1
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1832 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1833 call assert_equal("=>2 abcde", s:ScreenLine(2, 1, 9))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1834 call assert_equal(" 3 01234", s:ScreenLine(3, 1, 9))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1835 " Set 'signcolumn' to 'number', make sure the number column width increases
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1836 set signcolumn=number
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1837 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1838 call assert_equal("=> abcde", s:ScreenLine(2, 1, 8))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1839 call assert_equal(" 3 01234", s:ScreenLine(3, 1, 8))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1840 " Set 'signcolumn' to 'auto', make sure the number column width is 1.
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1841 set signcolumn=auto
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1842 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1843 call assert_equal("=>2 abcde", s:ScreenLine(2, 1, 9))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1844 call assert_equal(" 3 01234", s:ScreenLine(3, 1, 9))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1845 " Set 'signcolumn' to 'number', make sure the number column width is 2.
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1846 set signcolumn=number
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1847 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1848 call assert_equal("=> abcde", s:ScreenLine(2, 1, 8))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1849 call assert_equal(" 3 01234", s:ScreenLine(3, 1, 8))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1850 " Disable 'number' column
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1851 set nonumber
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1852 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1853 call assert_equal("=>abcde", s:ScreenLine(2, 1, 7))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1854 call assert_equal(" 01234", s:ScreenLine(3, 1, 7))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1855 " Enable 'number' column
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1856 set number
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1857 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1858 call assert_equal("=> abcde", s:ScreenLine(2, 1, 8))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1859 call assert_equal(" 3 01234", s:ScreenLine(3, 1, 8))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1860 " Remove the sign and make sure the width of the number column is 1.
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1861 call sign_unplace('', {'id' : 20})
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1862 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1863 call assert_equal("3 01234", s:ScreenLine(3, 1, 7))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1864 " When the first sign is placed with 'signcolumn' set to number, verify that
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1865 " the number column width increases
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1866 sign place 30 line=1 name=sign1
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1867 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1868 call assert_equal("=> 01234", s:ScreenLine(1, 1, 8))
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1869 call assert_equal(" 2 abcde", s:ScreenLine(2, 1, 8))
17427
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1870 " Add sign with multi-byte text
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1871 set numberwidth=4
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1872 sign place 40 line=2 name=sign2
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1873 redraw!
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1874 call assert_equal(" => 01234", s:ScreenLine(1, 1, 9))
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1875 call assert_equal(" V abcde", s:ScreenLine(2, 1, 9))
17247
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1876
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1877 sign unplace * group=*
17129
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1878 sign undefine sign1
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1879 set signcolumn&
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1880 set number&
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1881 enew! | close
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1882 endfunc
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1883
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1884 " Test for managing multiple signs using the sign functions
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1885 func Test_sign_funcs_multi()
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1886 call writefile(repeat(["Sun is shining"], 30), "Xsign")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1887 edit Xsign
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1888 let bnum = bufnr('')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1889
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1890 " Define multiple signs at once
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1891 call assert_equal([0, 0, 0, 0], sign_define([
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1892 \ {'name' : 'sign1', 'text' : '=>', 'linehl' : 'Search',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1893 \ 'texthl' : 'Search'},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1894 \ {'name' : 'sign2', 'text' : '=>', 'linehl' : 'Search',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1895 \ 'texthl' : 'Search'},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1896 \ {'name' : 'sign3', 'text' : '=>', 'linehl' : 'Search',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1897 \ 'texthl' : 'Search'},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1898 \ {'name' : 'sign4', 'text' : '=>', 'linehl' : 'Search',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1899 \ 'texthl' : 'Search'}]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1900
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1901 " Negative cases for sign_define()
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1902 call assert_equal([], sign_define([]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1903 call assert_equal([-1], sign_define([{}]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1904 call assert_fails('call sign_define([6])', 'E715:')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1905 call assert_fails('call sign_define(["abc"])', 'E715:')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1906 call assert_fails('call sign_define([[]])', 'E715:')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1907
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1908 " Place multiple signs at once with specific sign identifier
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1909 let l = sign_placelist([{'id' : 1, 'group' : 'g1', 'name' : 'sign1',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1910 \ 'buffer' : 'Xsign', 'lnum' : 11, 'priority' : 50},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1911 \ {'id' : 2, 'group' : 'g2', 'name' : 'sign2',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1912 \ 'buffer' : 'Xsign', 'lnum' : 11, 'priority' : 100},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1913 \ {'id' : 3, 'group' : '', 'name' : 'sign3',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1914 \ 'buffer' : 'Xsign', 'lnum' : 11}])
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1915 call assert_equal([1, 2, 3], l)
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1916 let s = sign_getplaced('Xsign', {'group' : '*'})
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1917 call assert_equal([
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1918 \ {'id' : 2, 'name' : 'sign2', 'lnum' : 11,
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1919 \ 'group' : 'g2', 'priority' : 100},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1920 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 11,
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1921 \ 'group' : 'g1', 'priority' : 50},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1922 \ {'id' : 3, 'name' : 'sign3', 'lnum' : 11,
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1923 \ 'group' : '', 'priority' : 10}], s[0].signs)
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1924
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1925 call sign_unplace('*')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1926
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1927 " Place multiple signs at once with auto-generated sign identifier
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1928 call assert_equal([1, 1, 5], sign_placelist([
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1929 \ {'group' : 'g1', 'name' : 'sign1',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1930 \ 'buffer' : 'Xsign', 'lnum' : 11},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1931 \ {'group' : 'g2', 'name' : 'sign2',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1932 \ 'buffer' : 'Xsign', 'lnum' : 11},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1933 \ {'group' : '', 'name' : 'sign3',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1934 \ 'buffer' : 'Xsign', 'lnum' : 11}]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1935 let s = sign_getplaced('Xsign', {'group' : '*'})
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1936 call assert_equal([
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1937 \ {'id' : 5, 'name' : 'sign3', 'lnum' : 11,
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1938 \ 'group' : '', 'priority' : 10},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1939 \ {'id' : 1, 'name' : 'sign2', 'lnum' : 11,
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1940 \ 'group' : 'g2', 'priority' : 10},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1941 \ {'id' : 1, 'name' : 'sign1', 'lnum' : 11,
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1942 \ 'group' : 'g1', 'priority' : 10}], s[0].signs)
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1943
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1944 " Change an existing sign without specifying the group
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
1945 call assert_equal([5], [{'id' : 5, 'name' : 'sign1', 'buffer' : 'Xsign'}]->sign_placelist())
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1946 let s = sign_getplaced('Xsign', {'id' : 5, 'group' : ''})
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1947 call assert_equal([{'id' : 5, 'name' : 'sign1', 'lnum' : 11,
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1948 \ 'group' : '', 'priority' : 10}], s[0].signs)
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1949
17805
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1950 " Place a sign using '.' as the line number
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1951 call cursor(23, 1)
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1952 call assert_equal([7], sign_placelist([
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1953 \ {'id' : 7, 'name' : 'sign1', 'buffer' : '%', 'lnum' : '.'}]))
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1954 let s = sign_getplaced('%', {'lnum' : '.'})
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1955 call assert_equal([{'id' : 7, 'name' : 'sign1', 'lnum' : 23,
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1956 \ 'group' : '', 'priority' : 10}], s[0].signs)
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1957
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1958 " Place sign without a sign name
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1959 call assert_equal([-1], sign_placelist([{'id' : 10, 'buffer' : 'Xsign',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1960 \ 'lnum' : 12, 'group' : ''}]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1961
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1962 " Place sign without a buffer
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1963 call assert_equal([-1], sign_placelist([{'id' : 10, 'name' : 'sign1',
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1964 \ 'lnum' : 12, 'group' : ''}]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1965
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1966 " Invalid arguments
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1967 call assert_equal([], sign_placelist([]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1968 call assert_fails('call sign_placelist({})', "E714:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1969 call assert_fails('call sign_placelist([[]])', "E715:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1970 call assert_fails('call sign_placelist(["abc"])', "E715:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1971 call assert_fails('call sign_placelist([100])', "E715:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1972
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1973 " Unplace multiple signs
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1974 call assert_equal([0, 0, 0], sign_unplacelist([{'id' : 5},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1975 \ {'id' : 1, 'group' : 'g1'}, {'id' : 1, 'group' : 'g2'}]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1976
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1977 " Invalid arguments
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
1978 call assert_equal([], []->sign_unplacelist())
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1979 call assert_fails('call sign_unplacelist({})', "E714:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1980 call assert_fails('call sign_unplacelist([[]])', "E715:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1981 call assert_fails('call sign_unplacelist(["abc"])', "E715:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1982 call assert_fails('call sign_unplacelist([100])', "E715:")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1983 call assert_fails("call sign_unplacelist([{'id' : -1}])", 'E474')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1984
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1985 call assert_equal([0, 0, 0, 0],
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1986 \ sign_undefine(['sign1', 'sign2', 'sign3', 'sign4']))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1987 call assert_equal([], sign_getdefined())
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1988
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1989 " Invalid arguments
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1990 call assert_equal([], sign_undefine([]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1991 call assert_fails('call sign_undefine([[]])', 'E730:')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1992 call assert_fails('call sign_undefine([{}])', 'E731:')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1993 call assert_fails('call sign_undefine(["1abc2"])', 'E155:')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1994
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1995 call sign_unplace('*')
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1996 call sign_undefine()
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1997 enew!
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1998 call delete("Xsign")
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1999 endfunc