annotate src/testdir/test_utf8.vim @ 30015:adb0de8be4ce v9.0.0345

patch 9.0.0345: error message for list argument could be clearer Commit: https://github.com/vim/vim/commit/d83392a43a48c566c0f3b76382a3648584dae32b Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 1 12:22:46 2022 +0100 patch 9.0.0345: error message for list argument could be clearer Problem: Error message for list argument could be clearer. Solution: Include the argument number. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11027)
author Bram Moolenaar <Bram@vim.org>
date Thu, 01 Sep 2022 13:30:05 +0200
parents 0667f71ec335
children 9e1062b4aa94
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
26946
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
3 source check.vim
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
4 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
5
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " 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
7 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
8 new
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 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
10 exe ":norm! gg0l\<C-V>jjIx\<Esc>"
27247
0667f71ec335 patch 8.2.4152: block insert with double wide character fails
Bram Moolenaar <Bram@vim.org>
parents: 26946
diff changeset
11 call assert_equal(['axaa', ' xあああ', 'bxbb'], getline(1, '$'))
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 bwipeout!
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endfunc
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14
24130
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
15 " Test for built-in functions strchars() and strcharlen()
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 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
18 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
19 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
20 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
21 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
22 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
23 endfor
24130
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
24
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
25 let exp = [1, 3, 1, 1, 1]
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
26 for i in range(len(inp))
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
27 call assert_equal(exp[i], inp[i]->strcharlen())
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
28 call assert_equal(exp[i], strcharlen(inp[i]))
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
29 endfor
c3d1f65365c4 patch 8.2.2606: strchars() defaults to counting composing characters
Bram Moolenaar <Bram@vim.org>
parents: 23064
diff changeset
30
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20109
diff changeset
31 call assert_fails("let v=strchars('abc', [])", 'E745:')
22153
7aa10e8e7aec patch 8.2.1626: test for strchars() fails with different error number
Bram Moolenaar <Bram@vim.org>
parents: 21975
diff changeset
32 call assert_fails("let v=strchars('abc', 2)", 'E1023:')
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endfunc
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " Test for customlist completion
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
36 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
37 return ['あ', 'い']
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
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
40 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
41 return ['あたし', 'あたま', 'あたりめ']
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
42 endfunc
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
44 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
45 return ['Nこ', 'Nん', 'Nぶ']
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 10720
diff changeset
46 endfunc
10720
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 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
49 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
50 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
51 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
52
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 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
54 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
55 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
56
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 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
58 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
59 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
60
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 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
62 endfunc
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " 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
65 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
66 new
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 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
68 normal 0lvy
44a1661f4cfa patch 8.0.0250: virtcol() does not work well for multi-byte characters
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 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
70 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
71 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
72 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
73 endfunc
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
74
16235
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
75 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
76 " One Unicode codepoint
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
77 let s = "\u3042\u3044"
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
78 let l = [0x3042, 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 " With composing characters
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
87 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
88 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
89 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
90 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
91 if &enc ==# 'utf-8'
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
92 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
93 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
94 endif
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
95
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
96 " 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
97 call assert_equal('', list2str([]))
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
98 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
99 endfunc
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
100
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
101 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
102 " 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
103 " 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
104 let s = "\u3042\u3044"
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
105 let l = [0x3042, 0x3044]
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
106
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
107 let save_encoding = &encoding
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
108 set encoding=latin1
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
109
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
110 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
111 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
112 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
113
20109
e82996ad131f patch 8.2.0610: some tests are still old style
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
114 " 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
115 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
116
16235
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
117 let &encoding = save_encoding
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
118 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
119 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
120 endfunc
219c58b3879c patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents: 16148
diff changeset
121
16133
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
122 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
123 new
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
124
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
125 " 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
126 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
127 redraw
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([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
129 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
130 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
131 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
132 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
133 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
134
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
135 " 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
136 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
137 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
138 redraw
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([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
140 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
141 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
142 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
143 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
144
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
145 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
146 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
147 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
148 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
149 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
150
16148
90b0f2227d73 patch 8.1.1079: no need for a separate ScreenLinesUtf8() test function
Bram Moolenaar <Bram@vim.org>
parents: 16133
diff changeset
151 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
152
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
153 bwipe!
eb087f8a26a8 patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
154 endfunc
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18017
diff changeset
155
21971
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
156 func Test_setcellwidths()
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
157 call setcellwidths([
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
158 \ [0x1330, 0x1330, 2],
21975
2030f8267db9 patch 8.2.1537: memory acccess error when using setcellwidths()
Bram Moolenaar <Bram@vim.org>
parents: 21971
diff changeset
159 \ [9999, 10000, 1],
21971
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
160 \ [0x1337, 0x1339, 2],
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
161 \])
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
162
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
163 call assert_equal(2, strwidth("\u1330"))
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
164 call assert_equal(1, strwidth("\u1336"))
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
165 call assert_equal(2, strwidth("\u1337"))
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
166 call assert_equal(2, strwidth("\u1339"))
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
167 call assert_equal(1, strwidth("\u133a"))
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
168
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
169 call setcellwidths([])
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
170
30015
adb0de8be4ce patch 9.0.0345: error message for list argument could be clearer
Bram Moolenaar <Bram@vim.org>
parents: 27247
diff changeset
171 call assert_fails('call setcellwidths(1)', 'E1211:')
21971
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
172
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
173 call assert_fails('call setcellwidths([1, 2, 0])', 'E1109:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
174
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
175 call assert_fails('call setcellwidths([[0x101]])', 'E1110:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
176 call assert_fails('call setcellwidths([[0x101, 0x102]])', 'E1110:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
177 call assert_fails('call setcellwidths([[0x101, 0x102, 1, 4]])', 'E1110:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
178 call assert_fails('call setcellwidths([["a"]])', 'E1110:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
179
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
180 call assert_fails('call setcellwidths([[0x102, 0x101, 1]])', 'E1111:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
181
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
182 call assert_fails('call setcellwidths([[0x101, 0x102, 0]])', 'E1112:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
183 call assert_fails('call setcellwidths([[0x101, 0x102, 3]])', 'E1112:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
184
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
185 call assert_fails('call setcellwidths([[0x111, 0x122, 1], [0x115, 0x116, 2]])', 'E1113:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
186 call assert_fails('call setcellwidths([[0x111, 0x122, 1], [0x122, 0x123, 2]])', 'E1113:')
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
187
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
188 call assert_fails('call setcellwidths([[0x33, 0x44, 2]])', 'E1114:')
26022
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
189
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
190 set listchars=tab:--\\u2192
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
191 call assert_fails('call setcellwidths([[0x2192, 0x2192, 2]])', 'E834:')
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
192
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
193 set fillchars=stl:\\u2501
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
194 call assert_fails('call setcellwidths([[0x2501, 0x2501, 2]])', 'E835:')
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
195
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
196 set listchars&
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
197 set fillchars&
30e60bfd5fb3 patch 8.2.3545: setcellwidths() may make 'listchars' or 'fillchars' invalid
Bram Moolenaar <Bram@vim.org>
parents: 24130
diff changeset
198 call setcellwidths([])
21971
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
199 endfunc
0bc43a704f56 patch 8.2.1535: it is not possible to specify cell widths of characters
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
200
23064
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
201 func Test_print_overlong()
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
202 " Text with more composing characters than MB_MAXBYTES.
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
203 new
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
204 call setline(1, 'axxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
205 s/x/\=nr2char(1629)/g
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
206 print
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
207 bwipe!
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
208 endfunc
89c324e327c0 patch 8.2.2078: illegal memory access when using :print on invalid text
Bram Moolenaar <Bram@vim.org>
parents: 22153
diff changeset
209
26946
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
210 func Test_recording_with_select_mode_utf8()
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
211 call Run_test_recording_with_select_mode_utf8()
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
212 endfunc
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
213
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
214 func Run_test_recording_with_select_mode_utf8()
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
215 new
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
216
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
217 " No escaping
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
218 call feedkeys("qacc12345\<Esc>gH哦\<Esc>q", "tx")
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
219 call assert_equal("哦", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
220 call assert_equal("cc12345\<Esc>gH哦\<Esc>", @a)
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
221 call setline(1, 'asdf')
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
222 normal! @a
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
223 call assert_equal("哦", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
224
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
225 " 固 is 0xE5 0x9B 0xBA where 0x9B is CSI
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
226 call feedkeys("qacc12345\<Esc>gH固\<Esc>q", "tx")
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
227 call assert_equal("固", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
228 call assert_equal("cc12345\<Esc>gH固\<Esc>", @a)
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
229 call setline(1, 'asdf')
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
230 normal! @a
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
231 call assert_equal("固", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
232
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
233 " 四 is 0xE5 0x9B 0x9B where 0x9B is CSI
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
234 call feedkeys("qacc12345\<Esc>gH四\<Esc>q", "tx")
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
235 call assert_equal("四", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
236 call assert_equal("cc12345\<Esc>gH四\<Esc>", @a)
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
237 call setline(1, 'asdf')
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
238 normal! @a
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
239 call assert_equal("四", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
240
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
241 " 倒 is 0xE5 0x80 0x92 where 0x80 is K_SPECIAL
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
242 call feedkeys("qacc12345\<Esc>gH倒\<Esc>q", "tx")
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
243 call assert_equal("倒", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
244 call assert_equal("cc12345\<Esc>gH倒\<Esc>", @a)
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
245 call setline(1, 'asdf')
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
246 normal! @a
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
247 call assert_equal("倒", getline(1))
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
248
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
249 bwipe!
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
250 endfunc
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
251
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
252 " This must be done as one of the last tests, because it starts the GUI, which
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
253 " cannot be undone.
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
254 func Test_zz_recording_with_select_mode_utf8_gui()
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
255 CheckCanRunGui
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
256
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
257 gui -f
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
258 call Run_test_recording_with_select_mode_utf8()
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
259 endfunc
8d4b44cc324e patch 8.2.4002: first char typed in Select mode can be wrong
Bram Moolenaar <Bram@vim.org>
parents: 26022
diff changeset
260
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18017
diff changeset
261 " vim: shiftwidth=2 sts=2 expandtab