Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
16210:4ef3771aa5e2 | 16211:5fb0f15fafea |
---|---|
112 | 112 |
113 enew! | 113 enew! |
114 set listchars& ff& | 114 set listchars& ff& |
115 endfunc | 115 endfunc |
116 | 116 |
117 " Test that unicode listchars characters get properly inserted | |
118 func Test_listchars_unicode() | |
119 enew! | |
120 let oldencoding=&encoding | |
121 set encoding=utf-8 | |
122 set ff=unix | |
123 | |
124 set listchars=eol:⇔,space:␣,nbsp:≠,tab:←↔→ | |
125 set list | |
126 | |
127 let nbsp = nr2char(0xa0) | |
128 call append(0, [ | |
129 \ "a\tb c".nbsp."d" | |
130 \ ]) | |
131 let expected = [ | |
132 \ 'a←↔↔↔↔↔→b␣c≠d⇔' | |
133 \ ] | |
134 redraw! | |
135 call cursor(1, 1) | |
136 call assert_equal(expected, ScreenLines(1, virtcol('$'))) | |
137 let &encoding=oldencoding | |
138 enew! | |
139 set listchars& ff& | |
140 endfunction | |
141 | |
142 " Tests that space characters following composing character won't get replaced | |
143 " by listchars. | |
117 func Test_listchars_composing() | 144 func Test_listchars_composing() |
118 enew! | 145 enew! |
119 let oldencoding=&encoding | 146 let oldencoding=&encoding |
120 set encoding=utf-8 | 147 set encoding=utf-8 |
121 set ff=unix | 148 set ff=unix |
122 set list | 149 set list |
123 | 150 |
124 set listchars=eol:$,space:_ | 151 set listchars=eol:$,space:_,nbsp:= |
152 | |
153 let nbsp1 = nr2char(0xa0) | |
154 let nbsp2 = nr2char(0x202f) | |
125 call append(0, [ | 155 call append(0, [ |
126 \ " \u3099 \u309A" | 156 \ " \u3099\t \u309A".nbsp1.nbsp1."\u0302".nbsp2.nbsp2."\u0302", |
127 \ ]) | 157 \ ]) |
128 let expected = [ | 158 let expected = [ |
129 \ "_ \u3099^I \u309A$" | 159 \ "_ \u3099^I \u309A=".nbsp1."\u0302=".nbsp2."\u0302$" |
130 \ ] | 160 \ ] |
131 redraw! | 161 redraw! |
132 call cursor(1, 1) | 162 call cursor(1, 1) |
133 let got = ScreenLines(1, virtcol('$')) | 163 call assert_equal(expected, ScreenLines(1, virtcol('$'))) |
134 bw! | |
135 call assert_equal(expected, got) | |
136 let &encoding=oldencoding | 164 let &encoding=oldencoding |
165 enew! | |
137 set listchars& ff& | 166 set listchars& ff& |
138 endfunction | 167 endfunction |