annotate src/testdir/test_signs.vim @ 28678:a16dae0be398 v8.2.4863

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