annotate src/testdir/test_utf8.vim @ 21776:2f8efe73cd7e

Added tag v8.2.1437 for changeset 6922d78b4d521f2177f2bedaf1f3159843f75f9a
author Bram Moolenaar <Bram@vim.org>
date Wed, 12 Aug 2020 22:30:08 +0200
parents 6a4806e326dd
children 0bc43a704f56
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for Unicode manipulations
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
3 source view_util.vim
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " Visual block Insert adjusts for multi-byte char
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 func Test_visual_block_insert()
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 new
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call setline(1, ["aaa", "あああ", "bbb"])
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 exe ":norm! gg0l\<C-V>jjIx\<Esc>"
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call assert_equal(['axaa', 'xあああ', 'bxbb'], getline(1, '$'))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 bwipeout!
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endfunc
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " Test for built-in function strchars()
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 func Test_strchars()
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let inp = ["a", "あいa", "A\u20dd", "A\u20dd\u20dd", "\u20dd"]
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 let exp = [[1, 1, 1], [3, 3, 3], [2, 2, 1], [3, 3, 1], [1, 1, 1]]
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 for i in range(len(inp))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal(exp[i][0], strchars(inp[i]))
18017
988e5a868b60 patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17994
diff changeset
20 call assert_equal(exp[i][1], inp[i]->strchars(0))
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal(exp[i][2], strchars(inp[i], 1))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endfor
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20109
diff changeset
23 call assert_fails("let v=strchars('abc', [])", 'E745:')
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18017
diff changeset
24 call assert_fails("let v=strchars('abc', 2)", 'E474:')
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 endfunc
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " Test for customlist completion
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
28 func CustomComplete1(lead, line, pos)
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 return ['あ', 'い']
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
30 endfunc
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
32 func CustomComplete2(lead, line, pos)
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 return ['あたし', 'あたま', 'あたりめ']
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
34 endfunc
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
36 func CustomComplete3(lead, line, pos)
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 return ['Nこ', 'Nん', 'Nぶ']
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
38 endfunc
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 func Test_customlist_completion()
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 command -nargs=1 -complete=customlist,CustomComplete1 Test1 echo
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call feedkeys(":Test1 \<C-L>\<C-B>\"\<CR>", 'itx')
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call assert_equal('"Test1 ', getreg(':'))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 command -nargs=1 -complete=customlist,CustomComplete2 Test2 echo
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call feedkeys(":Test2 \<C-L>\<C-B>\"\<CR>", 'itx')
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call assert_equal('"Test2 あた', getreg(':'))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 command -nargs=1 -complete=customlist,CustomComplete3 Test3 echo
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 call feedkeys(":Test3 \<C-L>\<C-B>\"\<CR>", 'itx')
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call assert_equal('"Test3 N', getreg(':'))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call garbagecollect(1)
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 endfunc
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 " Yank one 3 byte character and check the mark columns.
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 func Test_getvcol()
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 new
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call setline(1, "x\u2500x")
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 normal 0lvy
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 call assert_equal(2, col("'["))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call assert_equal(4, col("']"))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 call assert_equal(2, virtcol("'["))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 call assert_equal(2, virtcol("']"))
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 endfunc
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
66
16235
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
67 func Test_list2str_str2list_utf8()
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
68 " One Unicode codepoint
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
69 let s = "\u3042\u3044"
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
70 let l = [0x3042, 0x3044]
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
71 call assert_equal(l, str2list(s, 1))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
72 call assert_equal(s, list2str(l, 1))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
73 if &enc ==# 'utf-8'
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
74 call assert_equal(str2list(s), str2list(s, 1))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
75 call assert_equal(list2str(l), list2str(l, 1))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
76 endif
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
77
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
78 " With composing characters
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
79 let s = "\u304b\u3099\u3044"
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
80 let l = [0x304b, 0x3099, 0x3044]
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
81 call assert_equal(l, str2list(s, 1))
17916
2e53305f2239 patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 16235
diff changeset
82 call assert_equal(s, l->list2str(1))
16235
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
83 if &enc ==# 'utf-8'
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
84 call assert_equal(str2list(s), str2list(s, 1))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
85 call assert_equal(list2str(l), list2str(l, 1))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
86 endif
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
87
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
88 " Null list is the same as an empty list
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
89 call assert_equal('', list2str([]))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
90 call assert_equal('', list2str(test_null_list()))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
91 endfunc
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
92
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
93 func Test_list2str_str2list_latin1()
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
94 " When 'encoding' is not multi-byte can still get utf-8 string.
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
95 " But we need to create the utf-8 string while 'encoding' is utf-8.
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
96 let s = "\u3042\u3044"
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
97 let l = [0x3042, 0x3044]
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
98
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
99 let save_encoding = &encoding
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
100 set encoding=latin1
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
101
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
102 let lres = str2list(s, 1)
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
103 let sres = list2str(l, 1)
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18017
diff changeset
104 call assert_equal([65, 66, 67], str2list("ABC"))
16235
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
105
20109
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
106 " Try converting a list to a string in latin-1 encoding
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
107 call assert_equal([1, 2, 3], str2list(list2str([1, 2, 3])))
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
108
16235
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
109 let &encoding = save_encoding
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
110 call assert_equal(l, lres)
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
111 call assert_equal(s, sres)
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
112 endfunc
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
113
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
114 func Test_screenchar_utf8()
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
115 new
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
116
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
117 " 1-cell, with composing characters
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
118 call setline(1, ["ABC\u0308"])
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
119 redraw
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
120 call assert_equal([0x0041], screenchars(1, 1))
17994
0dcc2ee838dd patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
121 call assert_equal([0x0042], 1->screenchars(2))
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
122 call assert_equal([0x0043, 0x0308], screenchars(1, 3))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
123 call assert_equal("A", screenstring(1, 1))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
124 call assert_equal("B", screenstring(1, 2))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
125 call assert_equal("C\u0308", screenstring(1, 3))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
126
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
127 " 2-cells, with composing characters
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
128 let text = "\u3042\u3044\u3046\u3099"
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
129 call setline(1, text)
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
130 redraw
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
131 call assert_equal([0x3042], screenchars(1, 1))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
132 call assert_equal([0], screenchars(1, 2))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
133 call assert_equal([0x3044], screenchars(1, 3))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
134 call assert_equal([0], screenchars(1, 4))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
135 call assert_equal([0x3046, 0x3099], screenchars(1, 5))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
136
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
137 call assert_equal("\u3042", screenstring(1, 1))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
138 call assert_equal("", screenstring(1, 2))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
139 call assert_equal("\u3044", screenstring(1, 3))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
140 call assert_equal("", screenstring(1, 4))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
141 call assert_equal("\u3046\u3099", screenstring(1, 5))
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
142
16148
90b0f2227d73 patch 8.1.1079: no need for a separate ScreenLinesUtf8() test function
Bram Moolenaar <Bram@vim.org>
parents: 16133
diff changeset
143 call assert_equal([text . ' '], ScreenLines(1, 8))
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
144
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
145 bwipe!
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
146 endfunc
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18017
diff changeset
147
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18017
diff changeset
148 " vim: shiftwidth=2 sts=2 expandtab