comparison src/testdir/test_listchars.vim @ 24198:c784e176334c v8.2.2640

patch 8.2.2640: screenstring() returns non-existing composing characters Commit: https://github.com/vim/vim/commit/f1387285e2ebe5cb3688d729fc6fd01a169a76c1 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 22 17:11:15 2021 +0100 patch 8.2.2640: screenstring() returns non-existing composing characters Problem: screenstring() returns non-existing composing characters. Solution: Only use composing characters if there is a base character.
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Mar 2021 17:15:04 +0100
parents 4d88e660ce32
children ac54d215fbec
comparison
equal deleted inserted replaced
24197:3e3376cc7bb7 24198:c784e176334c
144 normal ggdG 144 normal ggdG
145 set listchars=nbsp:X,trail:Y 145 set listchars=nbsp:X,trail:Y
146 set list 146 set list
147 " Non-breaking space 147 " Non-breaking space
148 let nbsp = nr2char(0xa0) 148 let nbsp = nr2char(0xa0)
149 call append(0, [ ">".nbsp."<" ]) 149 call append(0, [ ">" .. nbsp .. "<" ])
150 150
151 let expected = '>X< ' 151 let expected = '>X< '
152 152
153 redraw! 153 redraw!
154 call cursor(1, 1) 154 call cursor(1, 1)
191 191
192 set listchars=eol:⇔,space:␣,nbsp:≠,tab:←↔→ 192 set listchars=eol:⇔,space:␣,nbsp:≠,tab:←↔→
193 set list 193 set list
194 194
195 let nbsp = nr2char(0xa0) 195 let nbsp = nr2char(0xa0)
196 call append(0, [ 196 call append(0, ["a\tb c" .. nbsp .. "d"])
197 \ "a\tb c".nbsp."d" 197 let expected = ['a←↔↔↔↔↔→b␣c≠d⇔']
198 \ ])
199 let expected = [
200 \ 'a←↔↔↔↔↔→b␣c≠d⇔'
201 \ ]
202 redraw! 198 redraw!
203 call cursor(1, 1) 199 call cursor(1, 1)
204 call assert_equal(expected, ScreenLines(1, virtcol('$'))) 200 call assert_equal(expected, ScreenLines(1, virtcol('$')))
205 let &encoding=oldencoding 201 let &encoding=oldencoding
206 enew! 202 enew!
219 set listchars=eol:$,space:_,nbsp:= 215 set listchars=eol:$,space:_,nbsp:=
220 216
221 let nbsp1 = nr2char(0xa0) 217 let nbsp1 = nr2char(0xa0)
222 let nbsp2 = nr2char(0x202f) 218 let nbsp2 = nr2char(0x202f)
223 call append(0, [ 219 call append(0, [
224 \ " \u3099\t \u309A".nbsp1.nbsp1."\u0302".nbsp2.nbsp2."\u0302", 220 \ " \u3099\t \u309A" .. nbsp1 .. nbsp1 .. "\u0302" .. nbsp2 .. nbsp2 .. "\u0302",
225 \ ]) 221 \ ])
226 let expected = [ 222 let expected = [
227 \ "_ \u3099^I \u309A=".nbsp1."\u0302=".nbsp2."\u0302$" 223 \ "_ \u3099^I \u309A=" .. nbsp1 .. "\u0302=" .. nbsp2 .. "\u0302$"
228 \ ] 224 \ ]
229 redraw! 225 redraw!
230 call cursor(1, 1) 226 call cursor(1, 1)
231 call assert_equal(expected, ScreenLines(1, virtcol('$'))) 227 call assert_equal(expected, ScreenLines(1, virtcol('$')))
232 let &encoding=oldencoding 228 let &encoding=oldencoding