annotate src/testdir/test_listchars.vim @ 16211:5fb0f15fafea v8.1.1110

patch 8.1.1110: composing chars on space wrong when 'listchars' is set commit https://github.com/vim/vim/commit/e5e4e22c1c15c8c22b14935affe969569acc8df9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 4 13:28:45 2019 +0200 patch 8.1.1110: composing chars on space wrong when 'listchars' is set Problem: Composing chars on space wrong when 'listchars' is set. Solution: Do not use "space" and "nbsp" entries of 'listchars' when there is a composing character. (Yee Cheng Chin, closes #4197)
author Bram Moolenaar <Bram@vim.org>
date Thu, 04 Apr 2019 13:30:05 +0200
parents 90b0f2227d73
children 80bb4ce2a281
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for 'listchars' display with 'list' and :list
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 source view_util.vim
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_listchars()
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 enew!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 set ff=unix
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 set list
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 set listchars+=tab:>-,space:.,trail:<
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call append(0, [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 \ ' aa ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 \ ' bb ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 \ ' cccc ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ 'dd ee ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ ' '
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ ])
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let expected = [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ '>-------aa>-----$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ '..bb>---<<$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \ '...cccc><$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 \ 'dd........ee<<>-$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 \ '<$'
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 \ ]
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 redraw!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 for i in range(1, 5)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call cursor(i, 1)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 endfor
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 set listchars-=trail:<
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let expected = [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ '>-------aa>-----$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ '..bb>---..$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ '...cccc>.$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ 'dd........ee..>-$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ '.$'
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ ]
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 redraw!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 for i in range(1, 5)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call cursor(i, 1)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfor
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
15502
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
45 " tab with 3rd character.
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
46 set listchars-=tab:>-
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
47 set listchars+=tab:<=>,trail:-
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
48 let expected = [
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
49 \ '<======>aa<====>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
50 \ '..bb<==>--$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
51 \ '...cccc>-$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
52 \ 'dd........ee--<>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
53 \ '-$'
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
54 \ ]
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
55 redraw!
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
56 for i in range(1, 5)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
57 call cursor(i, 1)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
58 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
59 endfor
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
60
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
61 set listchars-=trail:-
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
62 let expected = [
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
63 \ '<======>aa<====>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
64 \ '..bb<==>..$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
65 \ '...cccc>.$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
66 \ 'dd........ee..<>$',
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
67 \ '.$'
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
68 \ ]
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
69 redraw!
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
70 for i in range(1, 5)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
71 call cursor(i, 1)
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
72 call assert_equal([expected[i - 1]], ScreenLines(i, virtcol('$')))
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
73 endfor
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
74
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
75 set listchars-=tab:<=>
bc17a9d37810 patch 8.1.0759: showing two characters for tab is limited
Bram Moolenaar <Bram@vim.org>
parents: 12851
diff changeset
76 set listchars+=tab:>-
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 set listchars+=trail:<
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 set nolist
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 normal ggdG
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 call append(0, [
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 \ ' fff ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 \ ' gg ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 \ ' h ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 \ 'iii ',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 \ ])
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 let l = split(execute("%list"), "\n")
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 call assert_equal([
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 \ '..fff>--<<$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 \ '>-------gg>-----$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 \ '.....h>-$',
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 \ 'iii<<<<><<$', '$'], l)
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92
15715
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
93
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
94 " test nbsp
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
95 normal ggdG
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
96 set listchars=nbsp:X,trail:Y
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
97 set list
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
98 " Non-breaking space
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
99 let nbsp = nr2char(0xa0)
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
100 call append(0, [ ">".nbsp."<" ])
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
101
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
102 let expected = '>X< '
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
103
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
104 redraw!
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
105 call cursor(1, 1)
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
106 call assert_equal([expected], ScreenLines(1, virtcol('$')))
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
107
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
108 set listchars=nbsp:X
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
109 redraw!
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
110 call cursor(1, 1)
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
111 call assert_equal([expected], ScreenLines(1, virtcol('$')))
52930462eec4 patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Bram Moolenaar <Bram@vim.org>
parents: 15502
diff changeset
112
12851
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 enew!
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 set listchars& ff&
90aaa974594e patch 8.0.1302: still too many old style tests
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 endfunc
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
116
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
117 " Test that unicode listchars characters get properly inserted
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
118 func Test_listchars_unicode()
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
119 enew!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
120 let oldencoding=&encoding
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
121 set encoding=utf-8
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
122 set ff=unix
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
123
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
124 set listchars=eol:⇔,space:␣,nbsp:≠,tab:←↔→
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
125 set list
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
126
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
127 let nbsp = nr2char(0xa0)
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
128 call append(0, [
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
129 \ "a\tb c".nbsp."d"
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
130 \ ])
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
131 let expected = [
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
132 \ 'a←↔↔↔↔↔→b␣c≠d⇔'
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
133 \ ]
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
134 redraw!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
135 call cursor(1, 1)
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
136 call assert_equal(expected, ScreenLines(1, virtcol('$')))
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
137 let &encoding=oldencoding
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
138 enew!
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
139 set listchars& ff&
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
140 endfunction
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
141
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
142 " Tests that space characters following composing character won't get replaced
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
143 " by listchars.
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
144 func Test_listchars_composing()
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
145 enew!
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
146 let oldencoding=&encoding
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
147 set encoding=utf-8
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
148 set ff=unix
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
149 set list
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
150
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
151 set listchars=eol:$,space:_,nbsp:=
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
152
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
153 let nbsp1 = nr2char(0xa0)
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
154 let nbsp2 = nr2char(0x202f)
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
155 call append(0, [
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
156 \ " \u3099\t \u309A".nbsp1.nbsp1."\u0302".nbsp2.nbsp2."\u0302",
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
157 \ ])
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
158 let expected = [
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
159 \ "_ \u3099^I \u309A=".nbsp1."\u0302=".nbsp2."\u0302$"
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
160 \ ]
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
161 redraw!
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
162 call cursor(1, 1)
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
163 call assert_equal(expected, ScreenLines(1, virtcol('$')))
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
164 let &encoding=oldencoding
16211
5fb0f15fafea patch 8.1.1110: composing chars on space wrong when 'listchars' is set
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
165 enew!
16146
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
166 set listchars& ff&
aaa6e9a43a60 patch 8.1.1078: when 'listchars' is set a composing char on a space is wrong
Bram Moolenaar <Bram@vim.org>
parents: 15715
diff changeset
167 endfunction