annotate src/testdir/test_conceal.vim @ 35171:76c328389c46 default tip

Added tag v9.1.0411 for changeset ed3a90cecb19f1d38b0a9bbb9bf6ed60bace72f4
author Christian Brabandt <cb@256bit.org>
date Sun, 12 May 2024 09:30:05 +0200
parents 6b249d4970ad
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15426
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for 'conceal'.
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
3 source check.vim
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
4 CheckFeature conceal
15426
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 source screendump.vim
29413
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
7 source view_util.vim
15426
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 func Test_conceal_two_windows()
27324
d02a319c47ec patch 8.2.4190: all conceal tests are skipped without the screendumps feature
Bram Moolenaar <Bram@vim.org>
parents: 25818
diff changeset
10 CheckScreendump
d02a319c47ec patch 8.2.4190: all conceal tests are skipped without the screendumps feature
Bram Moolenaar <Bram@vim.org>
parents: 25818
diff changeset
11
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
12 let code =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
13 let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
14 call setline(1, lines)
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
15 syntax match test /|hidden|/ conceal
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
16 set conceallevel=2
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
17 set concealcursor=
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
18 exe "normal /here\r"
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
19 new
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
20 call setline(1, lines)
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
21 call setline(4, "Second window")
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
22 syntax match test /|hidden|/ conceal
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
23 set conceallevel=2
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
24 set concealcursor=nc
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
25 exe "normal /here\r"
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
26 [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
27
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29413
diff changeset
28 call writefile(code, 'XTest_conceal', 'D')
15426
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 " Check that cursor line is concealed
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 let buf = RunVimInTerminal('-S XTest_conceal', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 " Check that with concealed text vertical cursor movement is correct.
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 call term_sendkeys(buf, "k")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 call VerifyScreenDump(buf, 'Test_conceal_two_windows_02', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " Check that with cursor line is not concealed
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call term_sendkeys(buf, "j")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 call term_sendkeys(buf, ":set concealcursor=\r")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call VerifyScreenDump(buf, 'Test_conceal_two_windows_03', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 " Check that with cursor line is not concealed when moving cursor down
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 call term_sendkeys(buf, "j")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 call VerifyScreenDump(buf, 'Test_conceal_two_windows_04', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 " Check that with cursor line is not concealed when switching windows
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call term_sendkeys(buf, "\<C-W>\<C-W>")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 call VerifyScreenDump(buf, 'Test_conceal_two_windows_05', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 " Check that with cursor line is only concealed in Normal mode
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 call term_sendkeys(buf, ":set concealcursor=n\r")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06n', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 call term_sendkeys(buf, "a")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06i', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 call term_sendkeys(buf, "\<Esc>/e")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06c', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 call term_sendkeys(buf, "\<Esc>v")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call VerifyScreenDump(buf, 'Test_conceal_two_windows_06v', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 call term_sendkeys(buf, "\<Esc>")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 " Check that with cursor line is only concealed in Insert mode
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 call term_sendkeys(buf, ":set concealcursor=i\r")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07n', {})
25818
37bc83bbda91 patch 8.2.3444: concealed text not revealed when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
64 call term_sendkeys(buf, "14|a")
15426
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07i', {})
25818
37bc83bbda91 patch 8.2.3444: concealed text not revealed when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
66 call term_sendkeys(buf, "\<Esc>")
37bc83bbda91 patch 8.2.3444: concealed text not revealed when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
67 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07in', {})
37bc83bbda91 patch 8.2.3444: concealed text not revealed when leaving insert mode
Bram Moolenaar <Bram@vim.org>
parents: 21014
diff changeset
68 call term_sendkeys(buf, "/e")
15426
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07c', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 call term_sendkeys(buf, "\<Esc>v")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 call VerifyScreenDump(buf, 'Test_conceal_two_windows_07v', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 call term_sendkeys(buf, "\<Esc>")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 " Check that with cursor line is only concealed in Command mode
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 call term_sendkeys(buf, ":set concealcursor=c\r")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08n', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 call term_sendkeys(buf, "a")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08i', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 call term_sendkeys(buf, "\<Esc>/e")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08c', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 call term_sendkeys(buf, "\<Esc>v")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 call VerifyScreenDump(buf, 'Test_conceal_two_windows_08v', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 call term_sendkeys(buf, "\<Esc>")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 " Check that with cursor line is only concealed in Visual mode
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 call term_sendkeys(buf, ":set concealcursor=v\r")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09n', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 call term_sendkeys(buf, "a")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09i', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 call term_sendkeys(buf, "\<Esc>/e")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09c', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 call term_sendkeys(buf, "\<Esc>v")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 call VerifyScreenDump(buf, 'Test_conceal_two_windows_09v', {})
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 call term_sendkeys(buf, "\<Esc>")
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95
15434
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
96 " Check moving the cursor while in insert mode.
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
97 call term_sendkeys(buf, ":set concealcursor=\r")
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
98 call term_sendkeys(buf, "a")
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
99 call VerifyScreenDump(buf, 'Test_conceal_two_windows_10', {})
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
100 call term_sendkeys(buf, "\<Down>")
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
101 call VerifyScreenDump(buf, 'Test_conceal_two_windows_11', {})
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
102 call term_sendkeys(buf, "\<Esc>")
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
103
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
104 " Check the "o" command
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
105 call VerifyScreenDump(buf, 'Test_conceal_two_windows_12', {})
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
106 call term_sendkeys(buf, "o")
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
107 call VerifyScreenDump(buf, 'Test_conceal_two_windows_13', {})
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
108 call term_sendkeys(buf, "\<Esc>")
80e79573dd6e patch 8.1.0725: conceal mode is not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 15426
diff changeset
109
15426
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 " clean up
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 call StopVimInTerminal(buf)
8b78878311e0 patch 8.1.0721: conceal mode is not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 endfunc
15476
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
113
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
114 func Test_conceal_with_cursorline()
27324
d02a319c47ec patch 8.2.4190: all conceal tests are skipped without the screendumps feature
Bram Moolenaar <Bram@vim.org>
parents: 25818
diff changeset
115 CheckScreendump
d02a319c47ec patch 8.2.4190: all conceal tests are skipped without the screendumps feature
Bram Moolenaar <Bram@vim.org>
parents: 25818
diff changeset
116
15476
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
117 " Opens a help window, where 'conceal' is set, switches to the other window
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
118 " where 'cursorline' needs to be updated when the cursor moves.
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
119 let code =<< trim [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
120 set cursorline
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
121 normal othis is a test
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
122 new
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
123 call setline(1, ["one", "two", "three", "four", "five"])
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
124 set ft=help
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
125 normal M
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
126 [CODE]
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 15476
diff changeset
127
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29413
diff changeset
128 call writefile(code, 'XTest_conceal_cul', 'D')
15476
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
129 let buf = RunVimInTerminal('-S XTest_conceal_cul', {})
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
130 call VerifyScreenDump(buf, 'Test_conceal_cul_01', {})
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
131
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
132 call term_sendkeys(buf, ":wincmd w\r")
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
133 call VerifyScreenDump(buf, 'Test_conceal_cul_02', {})
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
134
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
135 call term_sendkeys(buf, "k")
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
136 call VerifyScreenDump(buf, 'Test_conceal_cul_03', {})
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
137
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
138 " clean up
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
139 call StopVimInTerminal(buf)
5b0f37d844b3 patch 8.1.0746: highlighting not updated with conceal and 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 15434
diff changeset
140 endfunc
18072
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
141
31618
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
142 func Test_conceal_with_cursorcolumn()
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
143 CheckScreendump
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
144
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
145 " Check that cursorcolumn and colorcolumn don't get broken in presence of
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
146 " wrapped lines containing concealed text
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
147 let code =<< trim [CODE]
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
148 let lines = ["one one one |hidden| one one one one one one one one",
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
149 \ "two two two two |hidden| here two two",
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
150 \ "three |hidden| three three three three three three three three"]
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
151 call setline(1, lines)
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
152 set wrap linebreak
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
153 set showbreak=\ >>>\
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
154 syntax match test /|hidden|/ conceal
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
155 set conceallevel=2
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
156 set concealcursor=
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
157 exe "normal /here\r"
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
158 set cursorcolumn
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
159 set colorcolumn=50
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
160 [CODE]
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
161
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
162 call writefile(code, 'XTest_conceal_cuc', 'D')
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
163 let buf = RunVimInTerminal('-S XTest_conceal_cuc', {'rows': 10, 'cols': 40})
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
164 call VerifyScreenDump(buf, 'Test_conceal_cuc_01', {})
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
165
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
166 " move cursor to the end of line (the cursor jumps to the next screen line)
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
167 call term_sendkeys(buf, "$")
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
168 call VerifyScreenDump(buf, 'Test_conceal_cuc_02', {})
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
169
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
170 " clean up
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
171 call StopVimInTerminal(buf)
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
172 endfunc
68fed60575ca patch 9.0.1141: 'cursorcolumn' and 'colorcolumn' wrong after concealing
Bram Moolenaar <Bram@vim.org>
parents: 30655
diff changeset
173
34546
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
174 " Check that 'cursorline' and 'wincolor' apply to the whole line in presence
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
175 " of wrapped lines containing concealed text.
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
176 func Test_conceal_wrapped_cursorline_wincolor()
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
177 CheckScreendump
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
178
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
179 let code =<< trim [CODE]
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
180 call setline(1, 'one one one |hidden| one one one one one one one one')
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
181 syntax match test /|hidden|/ conceal
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
182 set conceallevel=2 concealcursor=n cursorline
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
183 normal! g$
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
184 [CODE]
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
185
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
186 call writefile(code, 'XTest_conceal_cul_wcr', 'D')
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
187 let buf = RunVimInTerminal('-S XTest_conceal_cul_wcr', {'rows': 4, 'cols': 40})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
188 call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_01', {})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
189
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
190 call term_sendkeys(buf, ":set wincolor=ErrorMsg\n")
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
191 call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_02', {})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
192
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
193 call term_sendkeys(buf, ":set nocursorline\n")
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
194 call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_03', {})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
195
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
196 " clean up
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
197 call StopVimInTerminal(buf)
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
198 endfunc
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
199
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
200 " Same as Test_conceal_wrapped_cursorline_wincolor(), but with 'rightleft'.
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
201 func Test_conceal_wrapped_cursorline_wincolor_rightleft()
34707
6b249d4970ad patch 9.1.0232: Conceal test fails when rightleft feature is disabled
Christian Brabandt <cb@256bit.org>
parents: 34576
diff changeset
202 CheckFeature rightleft
34546
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
203 CheckScreendump
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
204
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
205 let code =<< trim [CODE]
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
206 call setline(1, 'one one one |hidden| one one one one one one one one')
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
207 syntax match test /|hidden|/ conceal
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
208 set conceallevel=2 concealcursor=n cursorline rightleft
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
209 normal! g$
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
210 [CODE]
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
211
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
212 call writefile(code, 'XTest_conceal_cul_wcr_rl', 'D')
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
213 let buf = RunVimInTerminal('-S XTest_conceal_cul_wcr_rl', {'rows': 4, 'cols': 40})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
214 call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_rl_01', {})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
215
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
216 call term_sendkeys(buf, ":set wincolor=ErrorMsg\n")
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
217 call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_rl_02', {})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
218
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
219 call term_sendkeys(buf, ":set nocursorline\n")
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
220 call VerifyScreenDump(buf, 'Test_conceal_cul_wcr_rl_03', {})
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
221
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
222 " clean up
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
223 call StopVimInTerminal(buf)
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
224 endfunc
33cb93a8d573 patch 9.1.0174: 'cursorline' and 'wincolor' hl missing with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
225
18072
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
226 func Test_conceal_resize_term()
27324
d02a319c47ec patch 8.2.4190: all conceal tests are skipped without the screendumps feature
Bram Moolenaar <Bram@vim.org>
parents: 25818
diff changeset
227 CheckScreendump
d02a319c47ec patch 8.2.4190: all conceal tests are skipped without the screendumps feature
Bram Moolenaar <Bram@vim.org>
parents: 25818
diff changeset
228
18072
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
229 let code =<< trim [CODE]
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
230 call setline(1, '`one` `two` `three` `four` `five`, the backticks should be concealed')
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
231 setl cocu=n cole=3
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
232 syn region CommentCodeSpan matchgroup=Comment start=/`/ end=/`/ concealends
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
233 normal fb
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
234 [CODE]
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29413
diff changeset
235 call writefile(code, 'XTest_conceal_resize', 'D')
18072
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
236 let buf = RunVimInTerminal('-S XTest_conceal_resize', {'rows': 6})
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
237 call VerifyScreenDump(buf, 'Test_conceal_resize_01', {})
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
238
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
239 call win_execute(buf->win_findbuf()[0], 'wincmd +')
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
240 call VerifyScreenDump(buf, 'Test_conceal_resize_02', {})
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
241
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
242 " clean up
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
243 call StopVimInTerminal(buf)
5f1554b2587c patch 8.1.2031: cursor position wrong when resizing and using conceal
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
244 endfunc
18870
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
245
30655
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
246 func Test_conceal_linebreak()
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
247 CheckScreendump
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
248
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
249 let code =<< trim [CODE]
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
250 vim9script
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
251 &wrap = true
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
252 &conceallevel = 2
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
253 &concealcursor = 'nc'
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
254 &linebreak = true
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
255 &showbreak = '+ '
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
256 var line: string = 'a`a`a`a`'
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
257 .. 'a'->repeat(&columns - 15)
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
258 .. ' b`b`'
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
259 .. 'b'->repeat(&columns - 10)
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
260 .. ' cccccc'
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
261 ['x'->repeat(&columns), '', line]->setline(1)
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
262 syntax region CodeSpan matchgroup=Delimiter start=/\z(`\+\)/ end=/\z1/ concealends
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
263 [CODE]
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
264 call writefile(code, 'XTest_conceal_linebreak', 'D')
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
265 let buf = RunVimInTerminal('-S XTest_conceal_linebreak', {'rows': 8})
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
266 call VerifyScreenDump(buf, 'Test_conceal_linebreak_1', {})
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
267
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
268 " clean up
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
269 call StopVimInTerminal(buf)
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
270 endfunc
0fbf3e042602 patch 9.0.0662: concealed characters do not work correctly
Bram Moolenaar <Bram@vim.org>
parents: 30164
diff changeset
271
18870
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
272 " Tests for correct display (cursor column position) with +conceal and
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
273 " tabulators. Need to run this test in a separate Vim instance. Otherwise the
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
274 " screen is not updated (lazy redraw) and the cursor position is wrong.
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
275 func Test_conceal_cursor_pos()
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
276 let code =<< trim [CODE]
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
277 :let l = ['start:', '.concealed. text', "|concealed|\ttext"]
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
278 :let l += ['', "\t.concealed.\ttext", "\t|concealed|\ttext", '']
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
279 :let l += [".a.\t.b.\t.c.\t.d.", "|a|\t|b|\t|c|\t|d|"]
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
280 :call append(0, l)
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
281 :call cursor(1, 1)
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
282 :" Conceal settings.
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
283 :set conceallevel=2
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
284 :set concealcursor=nc
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
285 :syntax match test /|/ conceal
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
286 :" Save current cursor position. Only works in <expr> mode, can't be used
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
287 :" with :normal because it moves the cursor to the command line. Thanks
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
288 :" to ZyX <zyx.vim@gmail.com> for the idea to use an <expr> mapping.
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
289 :let curpos = []
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
290 :nnoremap <expr> GG ":let curpos += ['".screenrow().":".screencol()."']\n"
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
291 :normal ztj
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
292 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
293 :" We should end up in the same column when running these commands on the
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
294 :" two lines.
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
295 :normal ft
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
296 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
297 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
298 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
299 :normal 0j
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
300 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
301 :normal ft
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
302 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
303 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
304 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
305 :normal 0j0j
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
306 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
307 :" Same for next test block.
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
308 :normal ft
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
309 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
310 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
311 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
312 :normal 0j
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
313 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
314 :normal ft
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
315 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
316 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
317 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
318 :normal 0j0j
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
319 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
320 :" And check W with multiple tabs and conceals in a line.
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
321 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
322 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
323 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
324 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
325 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
326 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
327 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
328 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
329 :normal 0j
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
330 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
331 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
332 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
333 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
334 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
335 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
336 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
337 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
338 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
339 :set lbr
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
340 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
341 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
342 :set list listchars=tab:>-
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
343 :normal 0
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
344 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
345 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
346 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
347 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
348 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
349 :normal W
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
350 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
351 :normal $
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
352 GGk
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
353 :call writefile(curpos, 'Xconceal_curpos.out')
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
354 :q!
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
355
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
356 [CODE]
30164
f7a2de8a4ddc patch 9.0.0418: manually deleting temp test files
Bram Moolenaar <Bram@vim.org>
parents: 29413
diff changeset
357 call writefile(code, 'XTest_conceal_curpos', 'D')
18870
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
358
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
359 if RunVim([], [], '-s XTest_conceal_curpos')
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
360 call assert_equal([
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
361 \ '2:1', '2:17', '2:20', '3:1', '3:17', '3:20', '5:8', '5:25',
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
362 \ '5:28', '6:8', '6:25', '6:28', '8:1', '8:9', '8:17', '8:25',
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
363 \ '8:27', '9:1', '9:9', '9:17', '9:25', '9:26', '9:26', '9:1',
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
364 \ '9:9', '9:17', '9:25', '9:26'], readfile('Xconceal_curpos.out'))
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
365 endif
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
366
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
367 call delete('Xconceal_curpos.out')
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
368 endfunc
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
369
21014
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
370 func Test_conceal_eol()
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
371 new!
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
372 setlocal concealcursor=n conceallevel=1
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
373 call setline(1, ["x", ""])
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
374 call matchaddpos('Conceal', [[2, 1, 1]], 2, -1, {'conceal': 1})
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
375 redraw!
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
376
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
377 call assert_notequal(screenchar(1, 1), screenchar(2, 2))
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
378 call assert_equal(screenattr(1, 1), screenattr(1, 2))
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
379 call assert_equal(screenattr(1, 2), screenattr(2, 2))
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
380 call assert_equal(screenattr(2, 1), screenattr(2, 2))
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
381
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
382 set list
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
383 redraw!
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
384
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
385 call assert_equal(screenattr(1, 1), screenattr(2, 2))
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
386 call assert_notequal(screenattr(1, 1), screenattr(1, 2))
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
387 call assert_notequal(screenattr(1, 2), screenattr(2, 1))
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
388
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
389 set nolist
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
390 endfunc
20133655107a patch 8.2.1058: multiline conceal causes display errors
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
391
29413
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
392 func Test_conceal_mouse_click()
34571
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
393 call NewWindow(10, 40)
29413
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
394 set mouse=a
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
395 setlocal conceallevel=2 concealcursor=nc
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
396 syn match Concealed "this" conceal
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
397 hi link Concealed Search
34571
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
398
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
399 " Test with both 'nocursorline' and 'cursorline', as they use two different
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
400 " code paths to set virtual columns for the cells to clear.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
401 for cul in [v:false, v:true]
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
402 let &l:cursorline = cul
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
403
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
404 call setline(1, 'conceal this click here')
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
405 call assert_equal([
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
406 \ 'conceal click here ',
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
407 \ ], ScreenLines(1, 40))
29413
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
408
34571
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
409 " Click on the space between "this" and "click" puts cursor there.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
410 call test_setmouse(1, 9)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
411 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
412 call assert_equal([0, 1, 13, 0, 13], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
413 " Click on 'h' of "here" puts cursor there.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
414 call test_setmouse(1, 16)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
415 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
416 call assert_equal([0, 1, 20, 0, 20], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
417 " Click on 'e' of "here" puts cursor there.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
418 call test_setmouse(1, 19)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
419 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
420 call assert_equal([0, 1, 23, 0, 23], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
421 " Click after end of line puts cursor on 'e' without 'virtualedit'.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
422 call test_setmouse(1, 20)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
423 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
424 call assert_equal([0, 1, 23, 0, 24], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
425 call test_setmouse(1, 21)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
426 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
427 call assert_equal([0, 1, 23, 0, 25], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
428 call test_setmouse(1, 22)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
429 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
430 call assert_equal([0, 1, 23, 0, 26], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
431 call test_setmouse(1, 31)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
432 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
433 call assert_equal([0, 1, 23, 0, 35], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
434 call test_setmouse(1, 32)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
435 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
436 call assert_equal([0, 1, 23, 0, 36], getcurpos())
32824
22a08166a876 patch 9.0.1725: cursor pos wrong after concealed text with 'virtualedit'
Christian Brabandt <cb@256bit.org>
parents: 31618
diff changeset
437
34571
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
438 set virtualedit=all
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
439 redraw
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
440 " Click on the space between "this" and "click" puts cursor there.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
441 call test_setmouse(1, 9)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
442 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
443 call assert_equal([0, 1, 13, 0, 13], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
444 " Click on 'h' of "here" puts cursor there.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
445 call test_setmouse(1, 16)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
446 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
447 call assert_equal([0, 1, 20, 0, 20], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
448 " Click on 'e' of "here" puts cursor there.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
449 call test_setmouse(1, 19)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
450 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
451 call assert_equal([0, 1, 23, 0, 23], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
452 " Click after end of line puts cursor there with 'virtualedit'.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
453 call test_setmouse(1, 20)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
454 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
455 call assert_equal([0, 1, 24, 0, 24], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
456 call test_setmouse(1, 21)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
457 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
458 call assert_equal([0, 1, 24, 1, 25], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
459 call test_setmouse(1, 22)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
460 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
461 call assert_equal([0, 1, 24, 2, 26], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
462 call test_setmouse(1, 31)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
463 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
464 call assert_equal([0, 1, 24, 11, 35], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
465 call test_setmouse(1, 32)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
466 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
467 call assert_equal([0, 1, 24, 12, 36], getcurpos())
34576
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
468 " Behavior should also be the same with 'colorcolumn'.
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
469 setlocal colorcolumn=30
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
470 redraw
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
471 call test_setmouse(1, 31)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
472 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
473 call assert_equal([0, 1, 24, 11, 35], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
474 call test_setmouse(1, 32)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
475 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
476 call assert_equal([0, 1, 24, 12, 36], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
477 setlocal colorcolumn&
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
478
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
479 if has('rightleft')
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
480 setlocal rightleft
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
481 call assert_equal([
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
482 \ ' ereh kcilc laecnoc',
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
483 \ ], ScreenLines(1, 40))
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
484 " Click on the space between "this" and "click" puts cursor there.
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
485 call test_setmouse(1, 41 - 9)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
486 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
487 call assert_equal([0, 1, 13, 0, 13], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
488 " Click on 'h' of "here" puts cursor there.
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
489 call test_setmouse(1, 41 - 16)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
490 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
491 call assert_equal([0, 1, 20, 0, 20], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
492 " Click on 'e' of "here" puts cursor there.
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
493 call test_setmouse(1, 41 - 19)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
494 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
495 call assert_equal([0, 1, 23, 0, 23], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
496 " Click after end of line puts cursor there with 'virtualedit'.
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
497 call test_setmouse(1, 41 - 20)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
498 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
499 call assert_equal([0, 1, 24, 0, 24], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
500 call test_setmouse(1, 41 - 21)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
501 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
502 call assert_equal([0, 1, 24, 1, 25], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
503 call test_setmouse(1, 41 - 22)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
504 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
505 call assert_equal([0, 1, 24, 2, 26], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
506 call test_setmouse(1, 41 - 31)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
507 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
508 call assert_equal([0, 1, 24, 11, 35], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
509 call test_setmouse(1, 41 - 32)
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
510 call feedkeys("\<LeftMouse>", "tx")
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
511 call assert_equal([0, 1, 24, 12, 36], getcurpos())
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
512 setlocal rightleft&
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
513 endif
563b0a3bd697 patch 9.1.0186: cursor pos wrong on mouse click after eol with 'rl', 've' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34571
diff changeset
514
34571
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
515 set virtualedit&
29413
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
516
34571
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
517 " Test with a wrapped line.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
518 call setline(1, ['conceal this click here']->repeat(3)->join())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
519 call assert_equal([
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
520 \ 'conceal click here conceal cli ',
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
521 \ 'ck here conceal click here ',
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
522 \ ], ScreenLines([1, 2], 40))
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
523 " Click on boguscols puts cursor on the last char of a screen line.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
524 for col in range(33, 40)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
525 call test_setmouse(1, col)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
526 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
527 call assert_equal([0, 1, 40, 0, 40], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
528 endfor
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
529
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
530 " Also test with the last char of a screen line concealed.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
531 setlocal number signcolumn=yes
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
532 call assert_equal([
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
533 \ ' 1 conceal click here conceal ',
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
534 \ ' click here conceal click h ',
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
535 \ ' ere ',
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
536 \ ], ScreenLines([1, 3], 40))
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
537 call test_setmouse(1, 34)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
538 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
539 call assert_equal([0, 1, 32, 0, 32], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
540 call test_setmouse(2, 7)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
541 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
542 call assert_equal([0, 1, 37, 0, 37], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
543 " Click on boguscols puts cursor on the last char of a screen line.
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
544 for col in range(35, 40)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
545 call test_setmouse(1, col)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
546 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
547 call assert_equal([0, 1, 34, 0, 34], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
548 call test_setmouse(2, col)
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
549 call feedkeys("\<LeftMouse>", "tx")
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
550 call assert_equal([0, 1, 68, 0, 68], getcurpos())
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
551 endfor
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
552 setlocal number& signcolumn&
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
553 endfor
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
554
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
555 call CloseWindow()
fdd232ab72ea patch 9.1.0184: Cursor pos wrong when clicking with conceal and wrap
Christian Brabandt <cb@256bit.org>
parents: 34559
diff changeset
556 set mouse&
29413
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
557 endfunc
34e93e046526 patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
558
34550
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
559 " Test that cursor is drawn at the correct column when it is after end of the
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
560 " line with 'virtualedit' and concealing.
34559
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
561 func Run_test_conceal_virtualedit_after_eol(wrap)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
562 let code =<< trim eval [CODE]
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
563 let &wrap = {a:wrap}
34550
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
564 call setline(1, 'abcdefgh|hidden|ijklmnpop')
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
565 syntax match test /|hidden|/ conceal
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
566 set conceallevel=2 concealcursor=n virtualedit=all
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
567 normal! $
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
568 [CODE]
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
569 call writefile(code, 'XTest_conceal_ve_after_eol', 'D')
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
570 let buf = RunVimInTerminal('-S XTest_conceal_ve_after_eol', {'rows': 3})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
571 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_1', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
572 call term_sendkeys(buf, "l")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
573 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_2', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
574 call term_sendkeys(buf, "l")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
575 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_3', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
576 call term_sendkeys(buf, "l")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
577 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_4', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
578 call term_sendkeys(buf, "rr")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
579 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_5', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
580
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
581 " clean up
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
582 call StopVimInTerminal(buf)
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
583 endfunc
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
584
34559
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
585 func Test_conceal_virtualedit_after_eol()
34550
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
586 CheckScreendump
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
587
34559
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
588 call Run_test_conceal_virtualedit_after_eol(1)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
589 call Run_test_conceal_virtualedit_after_eol(0)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
590 endfunc
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
591
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
592 " Same as Run_test_conceal_virtualedit_after_eol(), but with 'rightleft'.
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
593 func Run_test_conceal_virtualedit_after_eol_rightleft(wrap)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
594 let code =<< trim eval [CODE]
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
595 let &wrap = {a:wrap}
34550
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
596 call setline(1, 'abcdefgh|hidden|ijklmnpop')
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
597 syntax match test /|hidden|/ conceal
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
598 set conceallevel=2 concealcursor=n virtualedit=all rightleft
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
599 normal! $
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
600 [CODE]
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
601 call writefile(code, 'XTest_conceal_ve_after_eol_rl', 'D')
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
602 let buf = RunVimInTerminal('-S XTest_conceal_ve_after_eol_rl', {'rows': 3})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
603 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_rl_1', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
604 call term_sendkeys(buf, "h")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
605 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_rl_2', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
606 call term_sendkeys(buf, "h")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
607 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_rl_3', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
608 call term_sendkeys(buf, "h")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
609 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_rl_4', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
610 call term_sendkeys(buf, "rr")
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
611 call VerifyScreenDump(buf, 'Test_conceal_ve_after_eol_rl_5', {})
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
612
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
613 " clean up
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
614 call StopVimInTerminal(buf)
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
615 endfunc
4d8d41b7a8eb patch 9.1.0176: Cursor column wrong with 'virtualedit' and conceal
Christian Brabandt <cb@256bit.org>
parents: 34546
diff changeset
616
34559
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
617 func Test_conceal_virtualedit_after_eol_rightleft()
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
618 CheckFeature rightleft
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
619 CheckScreendump
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
620
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
621 call Run_test_conceal_virtualedit_after_eol_rightleft(1)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
622 call Run_test_conceal_virtualedit_after_eol_rightleft(0)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
623 endfunc
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
624
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
625 " Test that cursor position is correct when double-width chars are concealed.
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
626 func Run_test_conceal_double_width(wrap)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
627 let code =<< trim eval [CODE]
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
628 let &wrap = {a:wrap}
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
629 call setline(1, ['aaaaa口=口bbbbb口=口ccccc', 'foobar'])
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
630 syntax match test /口=口/ conceal cchar=β
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
631 set conceallevel=2 concealcursor=n colorcolumn=30
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
632 normal! $
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
633 [CODE]
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
634 call writefile(code, 'XTest_conceal_double_width', 'D')
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
635 let buf = RunVimInTerminal('-S XTest_conceal_double_width', {'rows': 4})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
636 call VerifyScreenDump(buf, 'Test_conceal_double_width_1', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
637 call term_sendkeys(buf, "gM")
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
638 call VerifyScreenDump(buf, 'Test_conceal_double_width_2', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
639 call term_sendkeys(buf, ":set conceallevel=3\<CR>")
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
640 call VerifyScreenDump(buf, 'Test_conceal_double_width_3', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
641 call term_sendkeys(buf, "$")
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
642 call VerifyScreenDump(buf, 'Test_conceal_double_width_4', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
643
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
644 " clean up
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
645 call StopVimInTerminal(buf)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
646 endfunc
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
647
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
648 func Test_conceal_double_width()
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
649 CheckScreendump
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
650
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
651 call Run_test_conceal_double_width(1)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
652 call Run_test_conceal_double_width(0)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
653 endfunc
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
654
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
655 " Test that line wrapping is correct when double-width chars are concealed.
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
656 func Test_conceal_double_width_wrap()
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
657 CheckScreendump
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
658
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
659 let code =<< trim [CODE]
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
660 call setline(1, 'aaaaaaaaaa口=口bbbbbbbbbb口=口cccccccccc')
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
661 syntax match test /口=口/ conceal cchar=β
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
662 set conceallevel=2 concealcursor=n
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
663 normal! $
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
664 [CODE]
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
665 call writefile(code, 'XTest_conceal_double_width_wrap', 'D')
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
666 let buf = RunVimInTerminal('-S XTest_conceal_double_width_wrap', {'rows': 4, 'cols': 20})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
667 call VerifyScreenDump(buf, 'Test_conceal_double_width_wrap_1', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
668 call term_sendkeys(buf, "gM")
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
669 call VerifyScreenDump(buf, 'Test_conceal_double_width_wrap_2', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
670 call term_sendkeys(buf, ":set conceallevel=3\<CR>")
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
671 call VerifyScreenDump(buf, 'Test_conceal_double_width_wrap_3', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
672 call term_sendkeys(buf, "$")
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
673 call VerifyScreenDump(buf, 'Test_conceal_double_width_wrap_4', {})
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
674
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
675 " clean up
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
676 call StopVimInTerminal(buf)
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
677 endfunc
ef55fe2ac8be patch 9.1.0180: Cursor pos wrong when double-width chars are concealed
Christian Brabandt <cb@256bit.org>
parents: 34550
diff changeset
678
18870
1895dd434ecf patch 8.1.2421: test88 is old style
Bram Moolenaar <Bram@vim.org>
parents: 18072
diff changeset
679 " vim: shiftwidth=2 sts=2 expandtab