annotate src/testdir/test_signs.vim @ 30938:84f6f91ca02a v9.0.0803

patch 9.0.0803: readblob() cannot read from character device Commit: https://github.com/vim/vim/commit/43625762a9751cc6e6e4d8f54fbc8b82d98fb20d Author: K.Takata <kentkt@csc.jp> Date: Thu Oct 20 13:28:51 2022 +0100 patch 9.0.0803: readblob() cannot read from character device Problem: readblob() cannot read from character device. Solution: Use S_ISCHR() to not check the size. (Ken Takata, closes https://github.com/vim/vim/issues/11407)
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Oct 2022 14:30:13 +0200
parents ae10b91ac6b3
children 552ca9b4218d
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
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
18 call Sign_command_ignore_error('sign define Sign2 text=xy texthl=Title linehl=Error culhl=Search numhl=Number 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 ' .
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
24 \ 'linehl=Error texthl=Title culhl=Search numhl=Number$', 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
26432
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
129 " an empty highlight argument for an existing sign clears it
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
130 sign define SignY texthl=TextHl culhl=CulHl linehl=LineHl numhl=NumHl
26432
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
131 let sl = sign_getdefined('SignY')[0]
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
132 call assert_equal('TextHl', sl.texthl)
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
133 call assert_equal('CulHl', sl.culhl)
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
134 call assert_equal('LineHl', sl.linehl)
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
135 call assert_equal('NumHl', sl.numhl)
26432
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
136
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
137 sign define SignY texthl= culhl=CulHl linehl=LineHl numhl=NumHl
26432
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
138 let sl = sign_getdefined('SignY')[0]
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
139 call assert_false(has_key(sl, 'texthl'))
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
140 call assert_equal('CulHl', sl.culhl)
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
141 call assert_equal('LineHl', sl.linehl)
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
142 call assert_equal('NumHl', sl.numhl)
26432
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
143
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
144 sign define SignY linehl=
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
145 let sl = sign_getdefined('SignY')[0]
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
146 call assert_false(has_key(sl, 'linehl'))
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
147 call assert_equal('CulHl', sl.culhl)
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
148 call assert_equal('NumHl', sl.numhl)
26432
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
149
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
150 sign define SignY culhl=
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
151 let sl = sign_getdefined('SignY')[0]
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
152 call assert_false(has_key(sl, 'culhl'))
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
153 call assert_equal('NumHl', sl.numhl)
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
154
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
155 sign define SignY numhl=
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
156 let sl = sign_getdefined('SignY')[0]
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
157 call assert_false(has_key(sl, 'numhl'))
26432
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
158
99a512bd8423 patch 8.2.3747: cannot remove highlight from an existing sign
Bram Moolenaar <Bram@vim.org>
parents: 26424
diff changeset
159 sign undefine SignY
26424
f6ca4276c4cc patch 8.2.3743: ":sign" can add a highlight group without a name
Bram Moolenaar <Bram@vim.org>
parents: 26266
diff changeset
160
15156
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
161 " 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
162 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
163 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
164 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
165 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
166
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
167 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
168 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
169 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
170 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
171
b63787182765 patch 8.1.0588: cannot define a sign with space in the text
Bram Moolenaar <Bram@vim.org>
parents: 12692
diff changeset
172 " 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
173 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
174 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
175 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
176 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
177
15322
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
178 " 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
179 sign unplace *
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
180 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
181 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
182 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
183 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
184 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
185 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
186 \ " 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
187 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
188 sign undefine 004
c6c306c5027f patch 8.1.0669: the ex_sign() function is too long
Bram Moolenaar <Bram@vim.org>
parents: 15304
diff changeset
189 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
190
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 " 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
192 sign undefine Sign1
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 sign undefine Sign2
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
194 sign undefine Sign3
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
195 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
196 \ bufnr('%'), 'E155:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
197 endfunc
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198
30383
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
199 func Test_sign_many_bytes()
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
200 new
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
201 set signcolumn=number
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
202 set number
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
203 call setline(1, 'some text')
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
204 " composing characters can use many bytes, check for overflow
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
205 sign define manyBytes text=▶᷄᷅᷆◀᷄᷅᷆᷇
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
206 sign place 17 line=1 name=manyBytes
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
207 redraw
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
208
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
209 bwipe!
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
210 sign undefine manyBytes
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
211 endfunc
9126e872893d patch 9.0.0527: long sign text may overflow buffer
Bram Moolenaar <Bram@vim.org>
parents: 30043
diff changeset
212
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
213 " Undefining placed sign is not recommended.
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
214 " Quoting :help sign
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
215 "
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
216 " :sign undefine {name}
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
217 " 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
218 " 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
219 func Test_sign_undefine_still_placed()
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
220 new foobar
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
221 sign define Sign text=x
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
222 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
223 sign undefine Sign
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
224
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
225 " 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
226 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
227 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
228 \ " 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
229
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
230 sign unplace 41
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
231 let a=execute('sign place')
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
232 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
233 endfunc
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 func Test_sign_completion()
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 sign define Sign1 text=x
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 sign define Sign2 text=y
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 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
240 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
241
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 call feedkeys(":sign define Sign \<C-A>\<C-B>\"\<CR>", 'tx')
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
243 call assert_equal('"sign define Sign culhl= icon= linehl= numhl= text= texthl=', @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
245 for hl in ['culhl', 'linehl', 'numhl', 'texthl']
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
246 call feedkeys(":sign define Sign "..hl.."=Spell\<C-A>\<C-B>\"\<CR>", 'tx')
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
247 call assert_equal('"sign define Sign '..hl..'=SpellBad SpellCap ' .
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
248 \ 'SpellLocal SpellRare', @:)
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
249 endfor
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
250
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
251 call writefile(repeat(["Sun is shining"], 30), "XsignOne", 'D')
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
252 call writefile(repeat(["Sky is blue"], 30), "XsignTwo", 'D')
10044
46e630ac4380 commit https://github.com/vim/vim/commit/64cefedfc834aa4dac54ae5f91ccbc04e2d56bc5
Christian Brabandt <cb@256bit.org>
parents: 9902
diff changeset
253 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
254 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
255
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
256 " 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
257 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
258 call assert_equal('"sign undefine Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 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
261 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
262 \ @:)
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 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
265 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
266
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
267 edit XsignOne
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
268 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
269 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
270 edit XsignTwo
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
271 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
272
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
273 " 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
274 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
275 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
276 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
277 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
278
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
279 " 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
280 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
281 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
282 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
283 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
284 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
285 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
286 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
287 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
288
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
289 " 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
290 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
291 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
292 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
293 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
294 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
295 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
296 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
297 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
298
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
299 " 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
300 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
301 call assert_equal('"sign list Sign1 Sign2', @:)
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
303 " 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
304 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
305 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
306 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
307 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
308 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
309 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
310
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
311 " Error cases
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
312 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
313 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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 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
322 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
323 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
324
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
325 sign unplace * group=*
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
326 sign undefine Sign1
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 sign undefine Sign2
15864
9e0154efac3a patch 8.1.0939: no completion for sign group names
Bram Moolenaar <Bram@vim.org>
parents: 15519
diff changeset
328 enew
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 endfunc
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 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
332 sign define Sign1 text=x
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
333
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
334 call assert_fails('sign', 'E471:')
9838
66f1cf5dd385 commit https://github.com/vim/vim/commit/446a973ce3ce4988607292c0e6345db788f12c7b
Christian Brabandt <cb@256bit.org>
parents: 9816
diff changeset
335 call assert_fails('sign jump', 'E471:')
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
336 call assert_fails('sign xxx', 'E160:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
337 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
338 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
339 call assert_fails('sign undefine', 'E156:')
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340 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
341 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
342 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
343 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
344 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
345 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
346 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
347 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
348 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
349 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
350 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
351 " 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
352 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
353 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
354 " 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
355 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
356 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
357 " 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
358 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
359 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
360 " 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
361 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
362 \ 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
363 " 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
364 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
365 " 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
366 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
367 \ bufnr('%') . 'xxx', 'E488:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
368 " 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
369 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
370 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
371 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
372 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
373 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
374 " 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
375 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
376 " 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
377 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
378 " 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
379 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
380 " 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
381 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
382 " 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
383 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
384 " 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
385 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
386 " 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
387 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
388 " 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
389 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
390 " 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
391 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
392 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
393 " 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
394 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
395
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
396 sign undefine Sign1
9816
74990ddf0813 commit https://github.com/vim/vim/commit/09de17536dd84e43aed7a575183e320e8d980b68
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 endfunc
9902
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
398
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
399 func Test_sign_delete_buffer()
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
400 new
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
401 sign define Sign text=x
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
402 let bufnr = bufnr('%')
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
403 new
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
404 exe 'bd ' . bufnr
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
405 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
406 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
407 sign unplace 61
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
408 sign undefine Sign
5a667a3a3743 commit https://github.com/vim/vim/commit/bfd096d02087a10e8e2f4bdfb74e0435506fa8bb
Christian Brabandt <cb@256bit.org>
parents: 9838
diff changeset
409 endfunc
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
410
17807
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
411 " 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
412 " 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
413 " 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
414 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
415 try
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
416 exe a:cmd
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
417 catch /E255:/
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
418 endtry
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
419 endfunc
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
420
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
421 " 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
422 " 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
423 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
424 try
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
425 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
426 catch /E255:/
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
427 endtry
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
428 endfunc
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
429
15271
a6319aca721b patch 8.1.0644: finding next sign ID is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15247
diff changeset
430 " 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
431 func Test_sign_funcs()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
432 " Remove all the signs
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
433 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
434 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
435
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
436 " Tests for sign_define()
26266
365e7f083f02 patch 8.2.3664: cannot adjust sign highlighting for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25690
diff changeset
437 let attr = {'text' : '=>', 'linehl' : 'Search', 'texthl' : 'Error',
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
438 \ 'culhl': 'Visual', 'numhl': 'Number'}
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
439 call assert_equal(0, "sign1"->sign_define(attr))
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
440 call assert_equal([{'name' : 'sign1', 'texthl' : 'Error', 'linehl' : 'Search',
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
441 \ 'culhl' : 'Visual', 'numhl': 'Number', 'text' : '=>'}],
26266
365e7f083f02 patch 8.2.3664: cannot adjust sign highlighting for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25690
diff changeset
442 \ sign_getdefined())
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
443
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
444 " 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
445 call sign_define("sign2")
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
446 let attr = {'text' : '!!', 'linehl' : 'DiffAdd', 'texthl' : 'DiffChange',
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
447 \ 'culhl': 'DiffDelete', 'numhl': 'Number', 'icon' : 'sign2.ico'}
17807
b38fa4d37b7c patch 8.1.1900: sign test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 17805
diff changeset
448 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
449 call assert_equal([{'name' : 'sign2', 'texthl' : 'DiffChange',
26266
365e7f083f02 patch 8.2.3664: cannot adjust sign highlighting for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 25690
diff changeset
450 \ 'linehl' : 'DiffAdd', 'culhl' : 'DiffDelete', 'text' : '!!',
26690
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
451 \ 'numhl': 'Number', 'icon' : 'sign2.ico'}],
84d60deb8f82 patch 8.2.3874: cannot highlight the number column for a sign
Bram Moolenaar <Bram@vim.org>
parents: 26434
diff changeset
452 \ "sign2"->sign_getdefined())
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
453
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
454 " 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
455 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
456 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
457 \ 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
458 eval 0002->sign_undefine()
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
459
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
460 " 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
461 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
462 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
463 call assert_fails('call sign_define({})', 'E731:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 26690
diff changeset
464 call assert_fails('call sign_define("sign6", [])', 'E1206:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
465
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
466 " Tests for sign_getdefined()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
467 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
468 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
469
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
470 " Tests for sign_place()
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
471 call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
472 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
473
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
474 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
475 \ {'lnum' : 20}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
476 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
477 \ [{'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
478 \ 'priority' : 10}]}], sign_getplaced('Xsign'))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
479 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
480 \ [{'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
481 \ 'priority' : 10}]}],
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
482 \ '%'->sign_getplaced({'lnum' : 20}))
15209
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 \ [{'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
485 \ '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
486 \ sign_getplaced('', {'id' : 10}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
487
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
488 " 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
489 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
490 call assert_fails('call sign_place(5, "", "mySign", -1)', 'E158:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 26690
diff changeset
491 call assert_fails('call sign_place(-1, "", "sign1", "Xsign", [])', 'E1206:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
492 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
493 \ {"lnum" : 30})', 'E474:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
494 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
495 \ {"lnum" : 30})', 'E155:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
496 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
497 \ {"lnum" : 30})', 'E155:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
498 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
499 \ {"lnum" : 30})', 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
500 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
501 \ {"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
502 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
503 \ 'E158:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
504 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
505 \ 'E730:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
506 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
507 \ {"lnum" : -1})', 'E474:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
508 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
509 \ {"lnum" : 0})', 'E474:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
510 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
511 \ {"lnum" : []})', 'E745:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
512 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
513
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
514 " Tests for sign_getplaced()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
515 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
516 \ [{'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
517 \ 'priority' : 10}]}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
518 \ sign_getplaced(bufnr('Xsign')))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
519 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
520 \ [{'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
521 \ 'priority' : 10}]}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
522 \ sign_getplaced())
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
523 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
524 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
525 call assert_fails('call sign_getplaced(-1)', 'E158:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 26690
diff changeset
526 call assert_fails('call sign_getplaced("Xsign", [])', 'E1206:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
527 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
528 \ sign_getplaced('Xsign', {'lnum' : 1000000}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
529 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
530 \ 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
531 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
532 \ sign_getplaced('Xsign', {'id' : 44}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
533 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
534 \ 'E745:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
535
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
536 " 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
537 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
538 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
539 \ {'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
540 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
541 \ {'id' : 30, 'buffer' : 'Xsign'}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
542 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
543 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
544 \ {'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
545 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
546 \ {'id' : 20, 'buffer' : '&'})", 'E158:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
547 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
548 \ {'id' : 20, 'buffer' : 200})", 'E158:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 26690
diff changeset
549 call assert_fails("call sign_unplace('g1', 'mySign')", 'E1206:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
550
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
551 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
552
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
553 " 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
554 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
555 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
556 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
557 \ [{'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
558 \ 'priority' : 10}]}],
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
559 \ sign_getplaced())
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
560
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
561 " Tests for sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
562 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
563 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
564 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
565 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
566
17805
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
567 " 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
568 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
569 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
570 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
571 \ {'lnum' : '.'}))
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
572 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
573 \ [{'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
574 \ 'priority' : 10}]}],
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
575 \ 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
576
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
577 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
578 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
579 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
580 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
581
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
582 " Tests for sign groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
583 func Test_sign_group()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
584 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
585 " Remove all the signs
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
586 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
587 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
588
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
589 call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
590
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
591 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
592 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
593
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
594 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
595 let bnum = bufnr('%')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
596
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
597 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
598 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
599 \ {'lnum' : 30})", 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
600
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
601 " 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
602 " others in the named groups
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
603 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
604 \ {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
605 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
606 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
607
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
608 " 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
609 let s = sign_getplaced('Xsign')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
610 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
611 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
612 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
613 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
614 \ '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
615 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
616 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
617 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
618 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
619 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
620 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
621 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
622 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
623 \ {'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
624 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
625 \ {'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
626 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
627 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
628
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
629 " 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
630 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
631 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
632 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
633 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
634 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
635 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
636 \ [{'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
637 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
638 \ s[0].signs)
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, {'id' : 5, 'group' : '*'})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
640 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
641 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
642 \ {'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
643 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
644 \ {'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
645 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
646 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
647 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
648 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
649
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
650 " 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
651 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
652 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
653 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
654 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
655 \ [{'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
656 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
657 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
658 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
659 call assert_equal(
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
660 \ [{'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
661 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
662 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
663 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
664 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
665
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
666 " Error case
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
667 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
668 \ 'E730:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
669
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
670 " 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
671 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
672 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
673 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
674 \ {'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
675 \ 'priority' : 10},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
676 \ {'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
677 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
678 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
679
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
680 " 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
681 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
682 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
683 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
684 \ {'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
685 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
686 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
687
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
688 " 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
689 call sign_unplace('*', {'buffer' : bnum})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
690 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
691
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
692 " 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
693 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
694 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
695 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
696 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
697 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
698
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
699 " Error case
30043
fd855ad74887 patch 9.0.0359: error message for wrong argument type is not specific
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
700 call assert_fails("call sign_unplace({})", 'E1174:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
701
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
702 " 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
703 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
704 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
705
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
706 " 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
707 " group
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
708 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
709 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
710 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
711 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
712 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
713 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
714 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
715 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
716 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
717 let s = sign_getplaced(bnum)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
718 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
719 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
720 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
721 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
722 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
723 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
724 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
725 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
726
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
727 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
728
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
729 " 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
730 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
731 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
732 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
733
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
734 " 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
735
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
736 " :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
737 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
738 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
739 \ " 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
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 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
742 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
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 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
745
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
746 " :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
747 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
748 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
749 \ " 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
750 \ " 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
751 \ " 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
752
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
753 " 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
754 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
755 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
756
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
757 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
758 let bnum = bufnr('Xsign')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
759 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
760 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
761 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
762
15300
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 buffer={fname}
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 buffer=' . bnum)
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
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", a)
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
767
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
768 " :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
769 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
770 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
771 \ " 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
772
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
773 " :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
774 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
775 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
776 \ " 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
777 \ " 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
778 \ " 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
779
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
780 " 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
781 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
782 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
783
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
784 " :sign place
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
785 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
786 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
787 \ " 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
788
15388
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
789 " 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
790 split foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
791 set buftype=nofile
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
792 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
793 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
794 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
795 \ " 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
796 \ "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
797 \ " 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
798 close
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
799 bwipe foo
7444fffa482d patch 8.1.0702: ":sign place" only uses the current buffer
Bram Moolenaar <Bram@vim.org>
parents: 15386
diff changeset
800
15300
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 group={group}
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
802 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
803 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
804 \ " 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
805
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 group=*
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
807 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
808 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
809 \ " 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
810 \ " 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
811 \ " 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
812
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
813 " 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
814 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
815 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
816 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
817 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
818 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
819
15378
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
820 " 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
821 sign jump 5
0d76dd701e49 patch 8.1.0697: ":sign place" requires the buffer argument
Bram Moolenaar <Bram@vim.org>
parents: 15343
diff changeset
822 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
823 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
824 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
825
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
826 " Error cases
15247
336728a577f5 patch 8.1.0632: using sign group names is inefficient
Bram Moolenaar <Bram@vim.org>
parents: 15209
diff changeset
827 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
828
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
829 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
830 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
831 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
832 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
833
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
834 " 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
835 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
836 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
837
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
838 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
839 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
840 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
841 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
842 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
843 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
844 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
845 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
846 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
847 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
848 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
849 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
850 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
851
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
852 " 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
853 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
854 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
855 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
856 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
857 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
858 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
859 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
860 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
861 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
862
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
863 " 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
864 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
865 enew | only
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
866 " 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
867 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
868 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
869
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
870 " Create two files and define signs
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
871 call writefile(repeat(["Sun is shining"], 30), "Xsign1", 'D')
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
872 call writefile(repeat(["It is beautiful"], 30), "Xsign2", 'D')
15300
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
873
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
874 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
875 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
876
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
877 edit Xsign1
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
878 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
879 split Xsign2
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
880 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
881
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
882 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
883 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
884 \ {'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
885 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
886 \ {'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
887 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
888 \ {'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
889 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
890 \ {'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
891 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
892 \ {'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
893 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
894 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
895 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
896 \ {'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
897 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
898 \ {'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
899 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
900 \ {'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
901 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
902 \ {'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
903 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
904 \ {'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
905 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
906
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
907 " 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
908 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
909 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
910 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
911 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
912 \ 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
913 \ {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
914 \ 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
915 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
916 \ 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
917 \ {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
918 \ 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
919
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
920 " 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
921 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
922 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
923 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
924 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
925 \ 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
926 \ {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
927 \ 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
928 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
929 \ 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
930 \ {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
931 \ 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
932
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
933 " 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
934 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
935 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
936 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
937 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
938 \ 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
939 \ {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
940 \ 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
941 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
942 \ 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
943 \ {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
944 \ 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
945
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
946 " 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
947 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
948 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
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.group != ''}),
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('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
953 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
954
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
955 " 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
956 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
957 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
958 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
959 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
960 \ 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
961 \ {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
962 \ 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
963 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
964 \ 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
965 \ {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
966 \ 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
967
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
968 " 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
969 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
970 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
971 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
972 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
973
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
974 " 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
975 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
976 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
977 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
978 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
979 \ 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
980 \ {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
981 \ 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
982 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
983 \ 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
984 \ {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
985 \ 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
986
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
987 " 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
988 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
989 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
990 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
991 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
992 \ 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
993 \ {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
994 \ 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
995 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
996 \ 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
997 \ {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
998 \ 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
999
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1000 " 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
1001 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
1002 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
1003 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
1004 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
1005 \ 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
1006 \ {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
1007 \ 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
1008 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
1009 \ 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
1010 \ {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
1011 \ 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
1012
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1013 " 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
1014 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
1015 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
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.group != ''}),
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(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
1020 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
1021
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1022 " 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
1023 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
1024 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
1025 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
1026 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
1027 \ 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
1028 \ {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
1029 \ 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
1030 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
1031 \ 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
1032 \ {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
1033 \ 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
1034
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1035 " 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
1036 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
1037 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
1038 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
1039 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
1040
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1041 " 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
1042 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
1043 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
1044 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
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(signs1),
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.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
1048 \ 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
1049 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
1050 \ 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
1051 \ {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
1052 \ 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
1053
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1054 " 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
1055 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
1056 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
1057 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
1058 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
1059 \ 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
1060 \ {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
1061 \ 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
1062 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
1063 \ 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
1064 \ {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
1065 \ 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
1066
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1067 " 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
1068 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
1069 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
1070 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
1071 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
1072 \ 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
1073 \ {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
1074 \ 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
1075 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
1076 \ 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
1077 \ {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
1078 \ 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
1079
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1080 " 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
1081 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
1082 sign unplace *
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1083 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
1084 \ 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
1085 \ {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
1086 \ 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
1087 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
1088 \ 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
1089 \ {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
1090 \ 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
1091
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1092 " 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
1093 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
1094 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
1095 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
1096 \ 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
1097 \ {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
1098 \ 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
1099 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
1100 \ 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
1101 \ {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
1102 \ 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
1103
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1104 " 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
1105 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
1106 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
1107 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
1108 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
1109
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1110 " 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
1111 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
1112 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
1113 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
1114 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
1115 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
1116 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
1117
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1118 " 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
1119
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1120 " 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
1121 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
1122 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1123 \ {'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
1124 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1125 \ {'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
1126 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1127 \ {'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
1128 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1129 \ {'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
1130 \ 'priority' : 10},
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1131 \ {'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
1132 \ 'priority' : 10},]
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1133 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
1134 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
1135
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1136 " 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
1137 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
1138 sign unplace
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1139 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
1140 \ 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
1141 \ {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
1142 \ 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
1143 " 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
1144 sign unplace
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1145 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
1146 \ 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
1147 \ {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
1148 \ 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
1149
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1150 " 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
1151 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
1152 " 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
1153 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
1154 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
1155 \ 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
1156 \ {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
1157 \ 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
1158 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
1159 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
1160 \ 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
1161 \ {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
1162 \ 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
1163
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1164 " 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
1165 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
1166 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
1167 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
1168 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
1169 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
1170 \ 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
1171 \ {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
1172 \ 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
1173 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
1174 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
1175 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
1176 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
1177
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1178 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
1179 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1180 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
1181 endfunc
890203d87ee5 patch 8.1.0658: deleting signs and completion for :sign is insufficient
Bram Moolenaar <Bram@vim.org>
parents: 15271
diff changeset
1182
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1183 " 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
1184 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
1185 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1186 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1187 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1188
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1189 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
1190 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
1191
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
1192 call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D')
15209
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 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
1196 \ {'lnum' : 10}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1197 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
1198 \ {'lnum' : 12}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1199 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
1200 \ {'lnum' : 14}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1201 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
1202 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
1203 \ {'lnum' : 12}))
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1204
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1205 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
1206 \ {'lnum' : 11}))
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1207 " 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
1208 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
1209 \ {'lnum' : 12}))
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1210 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
1211 call assert_equal(10,
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1212 \ 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
1213
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1214 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1215 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1216 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1217 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1218
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1219 " Test for sign priority
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1220 func Test_sign_priority()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1221 enew | only
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1222 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1223 call sign_undefine()
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1224
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1225 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
1226 call sign_define("sign1", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1227 call sign_define("sign2", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1228 call sign_define("sign3", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1229
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1230 " Place three signs with different priority in the same line
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
1231 call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1232 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1233
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1234 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
1235 \ {'lnum' : 11, 'priority' : 50})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1236 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
1237 \ {'lnum' : 11, 'priority' : 100})
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1238 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
1239 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
1240 call assert_equal([
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1241 \ {'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
1242 \ 'priority' : 100},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1243 \ {'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
1244 \ 'priority' : 50},
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1245 \ {'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
1246 \ 'priority' : 10}],
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1247 \ s[0].signs)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1248
16978
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1249 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1250
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1251 " 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
1252 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
1253 \ {'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
1254 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
1255 \ {'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
1256 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
1257 \ {'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
1258 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
1259 \ {'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
1260 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
1261 \ {'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
1262 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
1263 \ {'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
1264 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
1265 call assert_equal([
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' : 11, 'group' : '',
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1267 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1268 \ {'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
1269 \ 'priority' : 40},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1270 \ {'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
1271 \ 'priority' : 30}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1272 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1273
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1274 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1275
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1276 " 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
1277 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
1278 \ {'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
1279 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
1280 \ {'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
1281 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
1282 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1283 \ {'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
1284 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1285 \ {'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
1286 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1287 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1288 " 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
1289 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
1290 \ {'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
1291 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
1292 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1293 \ {'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
1294 \ 'priority' : 40},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1295 \ {'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
1296 \ 'priority' : 30}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1297 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1298 " 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
1299 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
1300 \ {'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
1301 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
1302 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1303 \ {'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
1304 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1305 \ {'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
1306 \ 'priority' : 25}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1307 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1308 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
1309 \ {'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
1310 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
1311 \ {'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
1312 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
1313 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1314 \ {'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
1315 \ 'priority' : 55},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1316 \ {'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
1317 \ 'priority' : 45}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1318 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1319
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1320 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1321
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1322 " 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
1323 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
1324 \ {'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
1325 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
1326 \ {'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
1327 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
1328 \ {'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
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' : 40},
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' : 30},
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 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
1340 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
1341 \ {'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
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' : 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
1347 \ 'priority' : 40},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1348 \ {'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
1349 \ 'priority' : 20}],
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 " 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
1353 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
1354 \ {'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
1355 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
1356 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1357 \ {'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
1358 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1359 \ {'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
1360 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1361 \ {'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
1362 \ 'priority' : 15}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1363 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1364
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1365 " 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
1366 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
1367 \ {'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
1368 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
1369 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1370 \ {'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
1371 \ 'priority' : 55},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1372 \ {'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
1373 \ 'priority' : 50},
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' : '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
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 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1377
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1378 " 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
1379 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
1380 \ {'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
1381 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
1382 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1383 \ {'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
1384 \ 'priority' : 50},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1385 \ {'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
1386 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1387 \ {'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
1388 \ 'priority' : 15}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1389 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1390
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1391 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1392
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1393 " 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
1394 " signs
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1395 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
1396 \ {'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
1397 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
1398 \ {'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
1399 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
1400 \ {'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
1401 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
1402 \ {'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
1403 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
1404 \ {'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
1405 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
1406 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1407 \ {'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
1408 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1409 \ {'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
1410 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1411 \ {'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
1412 \ 'priority' : 25},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1413 \ {'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
1414 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1415 \ {'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
1416 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1417 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1418
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1419 " 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
1420 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
1421 \ {'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
1422 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
1423 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1424 \ {'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
1425 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1426 \ {'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
1427 \ 'priority' : 25},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1428 \ {'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
1429 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1430 \ {'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
1431 \ 'priority' : 15},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1432 \ {'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
1433 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1434 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1435
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1436 " 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
1437 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
1438 \ {'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
1439 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
1440 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1441 \ {'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
1442 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1443 \ {'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
1444 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1445 \ {'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
1446 \ 'priority' : 25},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1447 \ {'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
1448 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1449 \ {'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
1450 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1451 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1452
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1453 " 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
1454 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
1455 \ {'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
1456 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
1457 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1458 \ {'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
1459 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1460 \ {'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
1461 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1462 \ {'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
1463 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1464 \ {'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
1465 \ 'priority' : 15},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1466 \ {'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
1467 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1468 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1469
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1470 " 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
1471 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
1472 \ {'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
1473 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
1474 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1475 \ {'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
1476 \ 'priority' : 10},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1477 \ {'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
1478 \ 'priority' : 35},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1479 \ {'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
1480 \ 'priority' : 30},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1481 \ {'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
1482 \ 'priority' : 15},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1483 \ {'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
1484 \ 'priority' : 80}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1485 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1486
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1487 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1488
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1489 " 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
1490 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
1491 \ {'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
1492 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
1493 \ {'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
1494 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
1495 \ {'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
1496 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
1497 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1498 \ {'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
1499 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1500 \ {'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
1501 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1502 \ {'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
1503 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1504 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1505 " 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
1506 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
1507 \ {'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
1508 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
1509 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1510 \ {'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
1511 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1512 \ {'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
1513 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1514 \ {'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
1515 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1516 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1517 " 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
1518 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
1519 \ {'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
1520 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
1521 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1522 \ {'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
1523 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1524 \ {'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
1525 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1526 \ {'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
1527 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1528 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1529 " 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
1530 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
1531 \ {'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
1532 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
1533 call assert_equal([
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1534 \ {'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
1535 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1536 \ {'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
1537 \ 'priority' : 20},
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1538 \ {'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
1539 \ 'priority' : 20}],
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1540 \ s[0].signs)
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1541
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1542 call sign_unplace('*')
15bc5a64bd50 patch 8.1.1489: sign order wrong when priority was changed
Bram Moolenaar <Bram@vim.org>
parents: 16930
diff changeset
1543
16930
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1544 " 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
1545 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
1546 \ {'lnum' : 5, 'priority' : 20})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1547 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
1548 \ {'lnum' : 5, 'priority' : 10})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1549 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
1550 call assert_equal([
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1551 \ {'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
1552 \ 'priority' : 10}],
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1553 \ s[0].signs)
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1554 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
1555 \ {'lnum' : 5, 'priority' : 5})
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1556 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
1557 call assert_equal([
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1558 \ {'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
1559 \ 'priority' : 5}],
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1560 \ s[0].signs)
1689b52cf297 patch 8.1.1466: not updating priority on existing sign
Bram Moolenaar <Bram@vim.org>
parents: 15864
diff changeset
1561
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1562 " Error case
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 26690
diff changeset
1563 call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', [])", 'E1206:')
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1564 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
1565 \ {'priority' : []})", 'E745:')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1566 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1567
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1568 " 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
1569 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
1570 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
1571 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
1572 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
1573 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
1574 \ " 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
1575 \ " 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
1576 \ " 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
1577
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1578 " 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
1579 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
1580 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
1581 \ " 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
1582
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1583 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1584 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1585 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1586 endfunc
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1587
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1588 " 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
1589 func Test_sign_memfailures()
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
1590 call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D')
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1591 edit Xsign
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1592
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1593 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
1594 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
1595 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
1596 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
1597 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
1598 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
1599 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
1600
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1601 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
1602 call sign_define("sign1", attr)
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1603 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
1604 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
1605
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1606 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
1607 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
1608 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
1609 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
1610 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
1611
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1612 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
1613 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
1614 \ 'E342:')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1615
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1616 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
1617 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
1618 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
1619 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
1620 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
1621 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
1622 \ '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
1623
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1624 call sign_unplace('*')
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1625 call sign_undefine()
15304
5bfdce4de97f patch 8.1.0660: sign_cleanup() may leak memory
Bram Moolenaar <Bram@vim.org>
parents: 15300
diff changeset
1626 enew | only
15209
3a99b2e6d136 patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents: 15156
diff changeset
1627 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
1628
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1629 " 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
1630 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
1631 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
1632
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1633 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
1634 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
1635 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
1636 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
1637 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
1638
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1639 " 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
1640 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
1641 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
1642 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
1643
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1644 " 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
1645 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
1646 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
1647 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
1648
15519
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1649 " 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
1650 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
1651 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
1652 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
1653
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1654 " 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
1655 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
1656 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
1657 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
1658
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1659 " 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
1660 " 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
1661 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
1662
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1663 " 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
1664 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
1665 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
1666 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
1667
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1668 " 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
1669 undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1670 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
1671 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
1672
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1673 " 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
1674 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
1675
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1676 " 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
1677 " 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
1678 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
1679 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
1680 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
1681
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1682 " 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
1683 undo
89e76a598b30 patch 8.1.0767: when deleting lines at the bottom signs are misplaced
Bram Moolenaar <Bram@vim.org>
parents: 15418
diff changeset
1684 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
1685 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
1686
15343
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1687 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
1688 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
1689 enew!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1690 endfunc
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1691
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1692 " 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
1693 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
1694 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
1695
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1696 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
1697 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
1698
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1699 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
1700 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
1701 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
1702 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
1703 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
1704 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
1705 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
1706 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
1707 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
1708 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
1709
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1710 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
1711 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
1712 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
1713 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
1714 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
1715 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
1716 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
1717 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
1718 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
1719
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1720 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
1721 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
1722 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
1723 enew!
8543eaf63f65 patch 8.1.0679: sign functions do not take buffer argument as documented
Bram Moolenaar <Bram@vim.org>
parents: 15322
diff changeset
1724 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
1725
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1726 " 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
1727 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
1728 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
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 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
1731
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1732 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
1733 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
1734 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
1735 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
1736 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
1737 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
1738 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
1739 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
1740 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
1741 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
1742 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
1743 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
1744 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
1745 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
1746
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1747 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
1748 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
1749 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
1750 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
1751 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
1752 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
1753 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
1754 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
1755 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
1756
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1757 " 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
1758 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
1759 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
1760 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
1761 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
1762 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
1763 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
1764 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
1765
51b3c36b0523 patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents: 15388
diff changeset
1766 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
1767 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
1768 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
1769 endfunc
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1770
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1771 " 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
1772 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
1773 CheckRunVimInTerminal
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1774
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1775 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
1776 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
1777 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
1778 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
1779 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
1780 redraw
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1781 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
1782 END
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
1783 call writefile(lines, 'XtestSigncolumn', 'D')
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1784 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
1785 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
1786
5cd0986ab02e patch 8.2.0108: when sign text is changed a manual redraw is needed
Bram Moolenaar <Bram@vim.org>
parents: 17998
diff changeset
1787 " 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
1788 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
1789 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
1790
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
1791 " 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
1792 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
1793 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
1794
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1795 " 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
1796 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
1797 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
1798 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
1799 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
1800
22013
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1801 " 'cursorline' highlighting overrules sign
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1802 call term_sendkeys(buf, ":sign place 12 line=2 name=s2\<CR>")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1803 call term_sendkeys(buf, ":set cursorline\<CR>")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1804 call term_sendkeys(buf, ":hi CursorLine ctermbg=Green\<CR>")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1805 call term_sendkeys(buf, "2G")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1806 call term_sendkeys(buf, ":\<CR>")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1807 call VerifyScreenDump(buf, 'Test_sign_cursor_5', {})
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1808
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1809 " sign highlighting overrules 'cursorline'
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1810 call term_sendkeys(buf, ":sign unplace 12\<CR>")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1811 call term_sendkeys(buf, ":sign place 13 line=2 priority=100 name=s2\<CR>")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1812 call term_sendkeys(buf, ":\<CR>")
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1813 call VerifyScreenDump(buf, 'Test_sign_cursor_6', {})
125051dff419 patch 8.2.1556: cursorline highlighting always overrules sign highlighting
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1814
17105
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1815 " clean up
811c5c2f5236 patch 8.1.1552: cursor position is wrong after sign column changes
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1816 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
1817 endfunc
17129
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1818
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1819 " 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
1820 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
1821 let s = ''
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1822 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
1823 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
1824 endfor
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1825 return s
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1826 endfunc
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1827
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1828 " 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
1829 func Test_sign_numcol()
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1830 new
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1831 call append(0, "01234")
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1832 " 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
1833 " 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
1834 set numberwidth=2
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1835 set number
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1836 set signcolumn=number
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1837 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
1838 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
1839 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
1840 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1841 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
1842
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1843 " 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
1844 " 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
1845 sign unplace 10
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1846 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1847 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
1848
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1849 " 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
1850 set numberwidth=4
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1851 set nonumber
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1852 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
1853 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1854 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
1855
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1856 " 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
1857 set number
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1858 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
1859 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
1860
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1861 " 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
1862 set signcolumn=no
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1863 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1864 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
1865
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1866 " 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
1867 set signcolumn=auto
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1868 redraw!
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1869 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
1870
17247
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1871 " 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
1872 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
1873 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
1874 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
1875 " 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
1876 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
1877 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1878 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
1879 " 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
1880 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
1881 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1882 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
1883 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
1884 " 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
1885 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
1886 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1887 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
1888 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
1889 " 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
1890 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
1891 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1892 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
1893 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
1894 " 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
1895 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
1896 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1897 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
1898 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
1899 " 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
1900 set nonumber
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1901 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1902 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
1903 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
1904 " 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
1905 set number
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1906 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1907 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
1908 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
1909 " 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
1910 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
1911 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1912 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
1913 " 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
1914 " 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
1915 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
1916 redraw!
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1917 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
1918 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
1919 " 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
1920 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
1921 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
1922 redraw!
45c1dc353321 patch 8.1.1712: signs in number column cause text to be misaligned
Bram Moolenaar <Bram@vim.org>
parents: 17366
diff changeset
1923 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
1924 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
1925
cbd0432cf8ff patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents: 17141
diff changeset
1926 sign unplace * group=*
17129
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1927 sign undefine sign1
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1928 set signcolumn&
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1929 set number&
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1930 enew! | close
4fb68abc770f patch 8.1.1564: sign column takes up space
Bram Moolenaar <Bram@vim.org>
parents: 17105
diff changeset
1931 endfunc
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1932
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1933 " 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
1934 func Test_sign_funcs_multi()
30769
ae10b91ac6b3 patch 9.0.0719: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30383
diff changeset
1935 call writefile(repeat(["Sun is shining"], 30), "Xsign", 'D')
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1936 edit Xsign
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1937 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
1938
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1939 " 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
1940 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
1941 \ {'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
1942 \ 'texthl' : 'Search'},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1943 \ {'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
1944 \ 'texthl' : 'Search'},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1945 \ {'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
1946 \ 'texthl' : 'Search'},
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1947 \ {'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
1948 \ 'texthl' : 'Search'}]))
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1949
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1950 " 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
1951 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
1952 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
1953 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
1954 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
1955 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
1956
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1957 " 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
1958 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
1959 \ '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
1960 \ {'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
1961 \ '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
1962 \ {'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
1963 \ '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
1964 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
1965 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
1966 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
1967 \ {'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
1968 \ '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
1969 \ {'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
1970 \ '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
1971 \ {'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
1972 \ '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
1973
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1974 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
1975
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1976 " 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
1977 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
1978 \ {'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
1979 \ '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
1980 \ {'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
1981 \ '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
1982 \ {'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
1983 \ '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
1984 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
1985 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
1986 \ {'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
1987 \ '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
1988 \ {'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
1989 \ '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
1990 \ {'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
1991 \ '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
1992
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
1993 " 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
1994 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
1995 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
1996 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
1997 \ '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
1998
17805
313f498c646e patch 8.1.1899: sign_place() does not work as documented
Bram Moolenaar <Bram@vim.org>
parents: 17427
diff changeset
1999 " 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
2000 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
2001 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
2002 \ {'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
2003 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
2004 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
2005 \ '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
2006
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2007 " 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
2008 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
2009 \ '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
2010
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2011 " 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
2012 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
2013 \ '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
2014
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2015 " Invalid arguments
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2016 call assert_equal([], sign_placelist([]))
30015
adb0de8be4ce patch 9.0.0345: error message for list argument could be clearer
Bram Moolenaar <Bram@vim.org>
parents: 29994
diff changeset
2017 call assert_fails('call sign_placelist({})', "E1211:")
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2018 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
2019 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
2020 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
2021
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2022 " 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
2023 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
2024 \ {'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
2025
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2026 " Invalid arguments
17998
ea916dbbb9b9 patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17807
diff changeset
2027 call assert_equal([], []->sign_unplacelist())
30015
adb0de8be4ce patch 9.0.0345: error message for list argument could be clearer
Bram Moolenaar <Bram@vim.org>
parents: 29994
diff changeset
2028 call assert_fails('call sign_unplacelist({})', "E1211:")
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2029 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
2030 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
2031 call assert_fails('call sign_unplacelist([100])', "E715:")
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 22013
diff changeset
2032 call assert_fails("call sign_unplacelist([{'id' : -1}])", 'E474:')
17366
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2033
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2034 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
2035 \ 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
2036 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
2037
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2038 " Invalid arguments
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2039 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
2040 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
2041 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
2042 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
2043
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2044 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
2045 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
2046 enew!
9843fbfa0ee5 patch 8.1.1682: placing a larger number of signs is slow
Bram Moolenaar <Bram@vim.org>
parents: 17247
diff changeset
2047 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
2048
25690
cb0868062915 patch 8.2.3381: crash when using NULL list with sign functions
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
2049 func Test_sign_null_list()
cb0868062915 patch 8.2.3381: crash when using NULL list with sign functions
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
2050 eval test_null_list()->sign_define()
cb0868062915 patch 8.2.3381: crash when using NULL list with sign functions
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
2051 eval test_null_list()->sign_placelist()
cb0868062915 patch 8.2.3381: crash when using NULL list with sign functions
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
2052 eval test_null_list()->sign_undefine()
cb0868062915 patch 8.2.3381: crash when using NULL list with sign functions
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
2053 eval test_null_list()->sign_unplacelist()
cb0868062915 patch 8.2.3381: crash when using NULL list with sign functions
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
2054 endfunc
cb0868062915 patch 8.2.3381: crash when using NULL list with sign functions
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
2055
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
2056 " vim: shiftwidth=2 sts=2 expandtab