annotate src/testdir/test_matchadd_conceal.vim @ 17049:f38fcbf343ce v8.1.1524

patch 8.1.1524: tests are silently skipped commit https://github.com/vim/vim/commit/b0f94c1ff34d27d33aa9f96204985ea29c2eb0a1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 13 22:19:53 2019 +0200 patch 8.1.1524: tests are silently skipped Problem: Tests are silently skipped. Solution: Throw an exception for skipped tests in more places.
author Bram Moolenaar <Bram@vim.org>
date Thu, 13 Jun 2019 22:30:07 +0200
parents 63b02fcf1361
children 8e9e9124c7a2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for matchadd() and conceal feature
17049
f38fcbf343ce patch 8.1.1524: tests are silently skipped
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
2
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('conceal')
17049
f38fcbf343ce patch 8.1.1524: tests are silently skipped
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
4 throw 'Skipped, conceal feature missing'
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 if !has('gui_running') && has('unix')
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set term=ansi
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endif
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
11 source shared.vim
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
13 func Test_simple_matchadd()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let expect = '# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call matchadd('Conceal', '\%2l ')
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 let lnum = 2
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
24 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
33 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
35 func Test_simple_matchadd_and_conceal()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 let expect = '#XThisXisXaXTest'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 let lnum = 2
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
47 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
55 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
57 func Test_matchadd_and_conceallevel_3()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 setlocal conceallevel=3
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 " set filetype and :syntax on to change screenattr()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 setlocal filetype=conf
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 syntax on
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 let expect = '#ThisisaTest'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'X'})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 let lnum = 2
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
73 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 " more matchadd()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 let expect = '#Thisisa Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call matchadd('ErrorMsg', '\%2l Test', 20, -1, {'conceal': 'X'})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 redraw!
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
86 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call assert_equal(screenattr(lnum, 2) , screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 call assert_equal(screenattr(lnum, 10), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call assert_notequal(screenattr(lnum, 10), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 syntax off
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
96 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
98 func Test_default_conceal_char()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 let expect = '# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 call matchadd('Conceal', '\%2l ', 10, -1, {})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 let lnum = 2
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
110 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 let expect = '#+This+is+a+Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 let listchars_save = &listchars
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 set listchars=conceal:+
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
123 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 let &listchars = listchars_save
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
132 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
134 func Test_syn_and_match_conceal()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 let expect = '#ZThisZisZaZTest'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 syntax match MyConceal /\%2l / conceal containedin=ALL cchar=*
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 let lnum = 2
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
147 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 let expect = '#*This*is*a*Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call clearmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
159 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 syntax off
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
168 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
170 func Test_clearmatches()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 let expect = '# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 let a = getmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 call clearmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 let lnum = 2
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
185 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 " reset match using setmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 let expect = '#ZThisZisZaZTest'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 call setmatches(a)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
198 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 call assert_equal({'group': 'Conceal', 'pattern': '\%2l ', 'priority': 10, 'id': a[0].id, 'conceal': 'Z'}, a[0])
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
207 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
209 func Test_using_matchaddpos()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 " set filetype and :syntax on to change screenattr()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 setlocal filetype=conf
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 syntax on
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 let expect = '#Pis a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call matchaddpos('Conceal', [[2,2,6]], 10, -1, {'conceal': 'P'})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 let a = getmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 let lnum = 2
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
226 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 2))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 call assert_notequal(screenattr(lnum, 2) , screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 7))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 12))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call assert_equal(screenattr(lnum, 12), screenattr(lnum, 16))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 call assert_equal({'group': 'Conceal', 'id': a[0].id, 'priority': 10, 'pos1': [2, 2, 6], 'conceal': 'P'}, a[0])
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 syntax off
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
238 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
240 func Test_matchadd_repeat_conceal_with_syntax_off()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 " To test targets in the same line string is replaced with conceal char
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 " correctly, repeat 'TARGET'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 1put ='TARGET_TARGETTARGET'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 redraw
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
248 call assert_equal('TARGET_TARGETTARGET', Screenline(2))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 setlocal conceallevel=2
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 call matchadd('Conceal', 'TARGET', 10, -1, {'conceal': 't'})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 redraw
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
254 call assert_equal('t_tt', Screenline(2))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
257 endfunc
10307
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
258
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
259 func Test_matchadd_and_syn_conceal()
10307
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
260 new
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
261 let cnt='Inductive bool : Type := | true : bool | false : bool.'
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
262 let expect = 'Inductive - : Type := | true : - | false : -.'
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
263 0put =cnt
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
264 " set filetype and :syntax on to change screenattr()
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
265 set cole=1 cocu=nv
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
266 hi link CheckedByCoq WarningMsg
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
267 syntax on
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
268 syntax keyword coqKwd bool conceal cchar=-
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
269 redraw!
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
270 call assert_equal(expect, Screenline(1))
10307
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
271 call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
272 call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
273 call assert_equal(screenattr(1, 11) , screenattr(1, 32))
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
274 call matchadd('CheckedByCoq', '\%<2l\%>9c\%<16c')
10313
694e3bb7a8ff commit https://github.com/vim/vim/commit/35a1f59d635d9a655e1267c18f7cc757afd0d5b0
Christian Brabandt <cb@256bit.org>
parents: 10307
diff changeset
275 redraw!
13359
81c348d40312 patch 8.0.1553: cannot see what digraph is used to insert a character
Christian Brabandt <cb@256bit.org>
parents: 10313
diff changeset
276 call assert_equal(expect, Screenline(1))
10307
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
277 call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
278 call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
279 call assert_equal(screenattr(1, 11) , screenattr(1, 32))
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
280 endfunc