Mercurial > vim
annotate src/testdir/test_utf8.vim @ 17337:9ccc84e56c4e
Added tag v8.1.1667 for changeset 81705f4d9e03bb884fcdc4f9889188f6b44e1889
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 12 Jul 2019 18:00:06 +0200 |
parents | 219c58b3879c |
children | 2e53305f2239 |
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])) |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal(exp[i][1], strchars(inp[i], 0)) |
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 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 endfunc |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 " Test for customlist completion |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10720
diff
changeset
|
26 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
|
27 return ['あ', 'い'] |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10720
diff
changeset
|
28 endfunc |
10720
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10720
diff
changeset
|
30 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
|
31 return ['あたし', 'あたま', 'あたりめ'] |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10720
diff
changeset
|
32 endfunc |
10720
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10720
diff
changeset
|
34 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
|
35 return ['Nこ', 'Nん', 'Nぶ'] |
15406
63b02fcf1361
patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents:
10720
diff
changeset
|
36 endfunc |
10720
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 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
|
39 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
|
40 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
|
41 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
|
42 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 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
|
48 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
|
49 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
|
50 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 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
|
52 endfunc |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 " 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
|
55 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
|
56 new |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 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
|
58 normal 0lvy |
44a1661f4cfa
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 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
|
60 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
|
61 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
|
62 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
|
63 endfunc |
16133
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
64 |
16235
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
65 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
|
66 " One Unicode codepoint |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
67 let s = "\u3042\u3044" |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
68 let l = [0x3042, 0x3044] |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
69 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
|
70 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
|
71 if &enc ==# 'utf-8' |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
72 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
|
73 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
|
74 endif |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
75 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
76 " With composing characters |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
77 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
|
78 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
|
79 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
|
80 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
|
81 if &enc ==# 'utf-8' |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
82 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
|
83 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
|
84 endif |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
85 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
86 " 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
|
87 call assert_equal('', list2str([])) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
88 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
|
89 endfunc |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
90 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
91 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
|
92 " 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
|
93 " 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
|
94 let s = "\u3042\u3044" |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
95 let l = [0x3042, 0x3044] |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
96 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
97 let save_encoding = &encoding |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
98 set encoding=latin1 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
99 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
100 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
|
101 let sres = list2str(l, 1) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
102 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
103 let &encoding = save_encoding |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
104 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
|
105 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
|
106 endfunc |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16148
diff
changeset
|
107 |
16133
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
108 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
|
109 new |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
110 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
111 " 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
|
112 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
|
113 redraw |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
114 call assert_equal([0x0041], screenchars(1, 1)) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
115 call assert_equal([0x0042], screenchars(1, 2)) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
116 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
|
117 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
|
118 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
|
119 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
|
120 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
121 " 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
|
122 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
|
123 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
|
124 redraw |
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([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
|
126 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
|
127 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
|
128 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
|
129 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
|
130 |
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("\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
|
132 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
|
133 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
|
134 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
|
135 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
|
136 |
16148
90b0f2227d73
patch 8.1.1079: no need for a separate ScreenLinesUtf8() test function
Bram Moolenaar <Bram@vim.org>
parents:
16133
diff
changeset
|
137 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
|
138 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
139 bwipe! |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
140 endfunc |