annotate src/testdir/test_matchadd_conceal.vim @ 30582:72245f9c9405 v9.0.0626

patch 9.0.0626: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/b152b6a40f729ed81a25d2fa541a4e73e201bec4 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 29 21:37:33 2022 +0100 patch 9.0.0626: too many delete() calls in tests Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
author Bram Moolenaar <Bram@vim.org>
date Thu, 29 Sep 2022 22:45:04 +0200
parents 2dcc6c9eb6e6
children
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
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 conceal
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 if !has('gui_running') && has('unix')
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 set term=ansi
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endif
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
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
10 source shared.vim
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
11 source term_util.vim
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
12 source view_util.vim
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
14 func Test_simple_matchadd()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 let expect = '# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call matchadd('Conceal', '\%2l ')
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 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
25 call assert_equal(expect, Screenline(lnum))
8907
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_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
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, 7))
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, 10))
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 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
31 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
32
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
34 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
36 func Test_simple_matchadd_and_conceal()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 let expect = '#XThisXisXaXTest'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 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
46 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 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
48 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 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
50 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
51 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
52 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
53 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
54
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
56 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
58 func Test_matchadd_and_conceallevel_3()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 setlocal conceallevel=3
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 " 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
63 setlocal filetype=conf
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 syntax on
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
66 1put='# This is a Test $'
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
67 " 1234567890123
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
68 let expect = '#ThisisaTest$'
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 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
72 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 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
74 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 2))
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
76 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 7))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
77 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 10))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
78 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 12))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
79 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 13))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
80 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 14))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 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
82
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 " more matchadd()
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
84 " 12345678901234
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
85 let expect = '#Thisisa Test$'
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 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
88 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
89 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 2))
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
91 call assert_equal(screenattr(lnum, 1) , screenattr(lnum, 7))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call assert_notequal(screenattr(lnum, 1) , screenattr(lnum, 10))
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
93 call assert_equal(screenattr(lnum, 10), screenattr(lnum, 13))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
94 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 14))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 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
96 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
97
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 syntax off
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
100 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
102 func Test_default_conceal_char()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 setlocal concealcursor=n conceallevel=1
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 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 let expect = '# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 call matchadd('Conceal', '\%2l ', 10, -1, {})
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 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
114 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 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
116 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
117 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
118 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
119 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
120
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 let expect = '#+This+is+a+Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 let listchars_save = &listchars
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 set listchars=conceal:+
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126
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
127 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 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
129 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
130 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
131 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
132 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
133
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 let &listchars = listchars_save
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
136 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
138 func Test_syn_and_match_conceal()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
142 1put='# This is a Test '
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
144 let lnum = 2
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 call cursor(1, 1)
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
146
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
147 " 123456789012345678
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
148 let expect = '#ZThisZisZaZTestZZ'
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 call matchadd('Conceal', '\%2l ', 10, -1, {'conceal': 'Z'})
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
150 syntax match MyConceal /\%2l / conceal containedin=ALL
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
151 hi MyConceal ctermbg=4 ctermfg=2
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 redraw!
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
153
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
154 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 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
156 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
157 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
158 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
159 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
160
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
161 syntax clear MyConceal
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
162 syntax match MyConceal /\%2l / conceal containedin=ALL cchar=*
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
163 redraw!
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
164
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
165 call assert_equal(expect, Screenline(lnum))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
166 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
167 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
168 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
169 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
170 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
171
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
172 " 123456789012345678
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
173 let expect = '#*This*is*a*Test**'
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 call clearmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
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
177 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 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
179 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
180 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
181 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
182 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
183
21010
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
184 " 123456789012345678
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
185 let expect = '#*ThisXis*a*Test**'
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
186 call matchadd('Conceal', '\%2l\%7c ', 10, -1, {'conceal': 'X'})
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
187 redraw!
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
188
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
189 call assert_equal(expect, Screenline(lnum))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
190 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
191 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 7))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
192 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 10))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
193 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
194 call assert_equal(screenattr(lnum, 1), screenattr(lnum, 16))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
195
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
196 " 123456789012345678
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
197 let expect = '#*ThisXis*a*Test**'
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
198 call matchadd('ErrorMsg', '\%2l Test', 20, -1)
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
199 redraw!
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
200
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
201 call assert_equal(expect, Screenline(lnum))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
202 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
203 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
204 call assert_notequal(screenattr(lnum, 12), screenattr(lnum, 13))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
205 call assert_equal(screenattr(lnum, 13), screenattr(lnum, 16))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
206 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 17))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
207 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 18))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
208 call assert_notequal(screenattr(lnum, 18), screenattr(lnum, 19))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
209
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
210 " 123456789012345678
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
211 let expect = '# ThisXis a Test'
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
212 syntax clear MyConceal
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
213 syntax match MyConceal /\%2l / conceal containedin=ALL
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
214 redraw!
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
215
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
216 call assert_equal(expect, Screenline(lnum))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
217 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 2))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
218 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 12))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
219 call assert_notequal(screenattr(lnum, 1), screenattr(lnum, 12))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
220 call assert_notequal(screenattr(lnum, 12), screenattr(lnum, 13))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
221 call assert_equal(screenattr(lnum, 13), screenattr(lnum, 16))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
222 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 17))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
223 call assert_equal(screenattr(lnum, 2), screenattr(lnum, 18))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
224 call assert_notequal(screenattr(lnum, 18), screenattr(lnum, 19))
ca2e18364888 patch 8.2.1056: wrong display when mixing match conceal and syntax conceal
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
225
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 syntax off
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
228 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
230 func Test_clearmatches()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 let expect = '# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 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
240 let a = getmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 call clearmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 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
245 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 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
247 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
248 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
249 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
250 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
251
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 " reset match using setmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 let expect = '#ZThisZisZaZTest'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 call setmatches(a)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257
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
258 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 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
260 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
261 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
262 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
263 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
264 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
265
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
267 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
269 func Test_using_matchaddpos()
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 setlocal concealcursor=n conceallevel=1
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 " 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
273 setlocal filetype=conf
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 syntax on
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 1put='# This is a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 " 1234567890123456
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 let expect = '#Pis a Test'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 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
282 let a = getmatches()
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 redraw!
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 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
286 call assert_equal(expect, Screenline(lnum))
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 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
288 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
289 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
290 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
291 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
292 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
293 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
294 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
295
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 syntax off
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
298 endfunc
8907
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
300 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
301 new
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 " 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
304 " correctly, repeat 'TARGET'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 1put ='TARGET_TARGETTARGET'
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 call cursor(1, 1)
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 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
308 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
309
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 setlocal conceallevel=2
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 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
312
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 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
314 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
315
5deb9e8f4292 commit https://github.com/vim/vim/commit/4d585022023b96f6507e8cae5ed8fc8d926f5140
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 quit!
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
317 endfunc
10307
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
318
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 13359
diff changeset
319 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
320 new
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
321 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
322 let expect = 'Inductive - : Type := | true : - | false : -.'
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
323 0put =cnt
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
324 " 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
325 set cole=1 cocu=nv
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
326 hi link CheckedByCoq WarningMsg
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
327 syntax on
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
328 syntax keyword coqKwd bool conceal cchar=-
f4798aebef67 commit https://github.com/vim/vim/commit/2f97912800e86a296c001832bbbf2fc425f1e533
Christian Brabandt <cb@256bit.org>
parents: 8907
diff changeset
329 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
330 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
331 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
332 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
333 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
334 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
335 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
336 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
337 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
338 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
339 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
340 endfunc
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
341
28788
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
342 func Test_interaction_matchadd_syntax()
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
343 new
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
344 " Test for issue #7268 fix.
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
345 " When redrawing the second column, win_line() was comparing the sequence
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
346 " number of the syntax-concealed region with a bogus zero value that was
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
347 " returned for the matchadd-concealed region. Before 8.0.0672 the sequence
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
348 " number was never reset, thus masking the problem.
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
349 call setline(1, 'aaa|bbb|ccc')
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
350 call matchadd('Conceal', '^..', 10, -1, #{conceal: 'X'})
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
351 syn match foobar '^.'
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
352 setl concealcursor=n conceallevel=1
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
353 redraw!
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
354
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
355 call assert_equal('Xa|bbb|ccc', Screenline(1))
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
356 call assert_notequal(screenattr(1, 1), screenattr(1, 2))
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
357
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
358 bwipe!
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
359 endfunc
a79f44a2d1ce patch 8.2.4918: conceal character from matchadd() displayed too many times
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
360
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
361 func Test_cursor_column_in_concealed_line_after_window_scroll()
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
362 CheckRunVimInTerminal
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
363
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
364 " Test for issue #5012 fix.
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
365 " For a concealed line with cursor, there should be no window's cursor
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
366 " position invalidation during win_update() after scrolling attempt that is
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
367 " not successful and no real topline change happens. The invalidation would
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
368 " cause a window's cursor position recalc outside of win_line() where it's
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
369 " not possible to take conceal into account.
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
370 let lines =<< trim END
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
371 3split
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
372 let m = matchadd('Conceal', '=')
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
373 setl conceallevel=2 concealcursor=nc
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
374 normal gg
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
375 "==expr==
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
376 END
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28798
diff changeset
377 call writefile(lines, 'Xcolesearch', 'D')
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
378 let buf = RunVimInTerminal('Xcolesearch', {})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 18836
diff changeset
379 call TermWait(buf, 50)
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
380
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
381 " Jump to something that is beyond the bottom of the window,
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
382 " so there's a scroll down.
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
383 call term_sendkeys(buf, ":so %\<CR>")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 18836
diff changeset
384 call TermWait(buf, 50)
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
385 call term_sendkeys(buf, "/expr\<CR>")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 18836
diff changeset
386 call TermWait(buf, 50)
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
387
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
388 " Are the concealed parts of the current line really hidden?
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
389 let cursor_row = term_scrape(buf, '.')->map({_, e -> e.chars})->join('')
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
390 call assert_equal('"expr', cursor_row)
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
391
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
392 " BugFix check: Is the window's cursor column properly updated for hidden
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
393 " parts of the current line?
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
394 call assert_equal(2, term_getcursor(buf)[1])
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
395
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
396 call StopVimInTerminal(buf)
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
397 endfunc
18621
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
398
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
399 func Test_cursor_column_in_concealed_line_after_leftcol_change()
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
400 CheckRunVimInTerminal
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
401
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
402 " Test for issue #5214 fix.
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
403 let lines =<< trim END
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
404 0put = 'ab' .. repeat('-', &columns) .. 'c'
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
405 call matchadd('Conceal', '-')
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
406 set nowrap ss=0 cole=3 cocu=n
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
407 END
30582
72245f9c9405 patch 9.0.0626: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28798
diff changeset
408 call writefile(lines, 'Xcurs-columns', 'D')
18621
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
409 let buf = RunVimInTerminal('-S Xcurs-columns', {})
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
410
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
411 " Go to the end of the line (3 columns beyond the end of the screen).
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
412 " Horizontal scroll would center the cursor in the screen line, but conceal
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
413 " makes it go to screen column 1.
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
414 call term_sendkeys(buf, "$")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 18836
diff changeset
415 call TermWait(buf)
18621
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
416
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
417 " Are the concealed parts of the current line really hidden?
18836
7882ccab03da patch 8.1.2405: matchadd_conceal test fails under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 18621
diff changeset
418 call WaitForAssert({-> assert_equal('c', term_getline(buf, '.'))})
18621
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
419
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
420 " BugFix check: Is the window's cursor column properly updated for conceal?
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
421 call assert_equal(1, term_getcursor(buf)[1])
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
422
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
423 call StopVimInTerminal(buf)
a9bfdc5ea1ec patch 8.1.2303: cursor in wrong position after horizontal scroll
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
424 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21010
diff changeset
425
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21010
diff changeset
426 " vim: shiftwidth=2 sts=2 expandtab