annotate runtime/tools/unicode.vim @ 29272:8175cd4c8fdd v8.2.5154

patch 8.2.5154: still mentioning version8, some cosmetic issues Commit: https://github.com/vim/vim/commit/abd56da30bae4a5c6c20b9363ccae12f7b126026 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 23 20:46:27 2022 +0100 patch 8.2.5154: still mentioning version8, some cosmetic issues Problem: Still mentioning version8, some cosmetic issues. Solution: Prefer mentioning version9, cosmetic improvements.
author Bram Moolenaar <Bram@vim.org>
date Thu, 23 Jun 2022 22:00:04 +0200
parents 042560a16d4e
children 3ee335235412
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
1 " Script to extract tables from Unicode .txt files, to be used in src/mbyte.c.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
2 " The format of the UnicodeData.txt file is explained here:
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
3 " http://www.unicode.org/Public/5.1.0/ucd/UCD.html
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
4 " For the other files see the header.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
5 "
11539
f7ba69508fd5 patch 8.0.0652: unicode information is outdated
Christian Brabandt <cb@256bit.org>
parents: 8706
diff changeset
6 " Might need to update the URL to the emoji-data.txt
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
7 " Usage: Vim -S <this-file>
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
8 "
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
9 " Author: Bram Moolenaar
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
10 " Last Update: 2020 Aug 24
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
11
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
12 " Parse lines of UnicodeData.txt. Creates a list of lists in s:dataprops.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
13 func! ParseDataToProps()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
14 let s:dataprops = []
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
15 let lnum = 1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
16 while lnum <= line('$')
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
17 let l = split(getline(lnum), '\s*;\s*', 1)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
18 if len(l) != 15
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
19 echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 15'
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
20 return
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
21 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
22 call add(s:dataprops, l)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
23 let lnum += 1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
24 endwhile
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
25 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
26
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
27 " Parse lines of CaseFolding.txt. Creates a list of lists in s:foldprops.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
28 func! ParseFoldProps()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
29 let s:foldprops = []
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
30 let lnum = 1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
31 while lnum <= line('$')
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
32 let line = getline(lnum)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
33 if line !~ '^#' && line !~ '^\s*$'
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
34 let l = split(line, '\s*;\s*', 1)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
35 if len(l) != 4
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
36 echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 4'
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
37 return
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
38 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
39 call add(s:foldprops, l)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
40 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
41 let lnum += 1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
42 endwhile
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
43 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
44
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
45 " Parse lines of EastAsianWidth.txt. Creates a list of lists in s:widthprops.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
46 func! ParseWidthProps()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
47 let s:widthprops = []
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
48 let lnum = 1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
49 while lnum <= line('$')
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
50 let line = getline(lnum)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
51 if line !~ '^#' && line !~ '^\s*$'
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
52 let l = split(line, '\s*;\s*', 1)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
53 if len(l) != 2
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
54 echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 2'
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
55 return
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
56 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
57 call add(s:widthprops, l)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
58 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
59 let lnum += 1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
60 endwhile
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
61 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
62
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
63 " Build the toLower or toUpper table in a new buffer.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
64 " Uses s:dataprops.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
65 func! BuildCaseTable(name, index)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
66 let start = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
67 let end = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
68 let step = 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
69 let add = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
70 let ranges = []
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
71 for p in s:dataprops
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
72 if p[a:index] != ''
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
73 let n = ('0x' . p[0]) + 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
74 let nl = ('0x' . p[a:index]) + 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
75 if start >= 0 && add == nl - n && (step == 0 || n - end == step)
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
76 " continue with same range.
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
77 let step = n - end
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
78 let end = n
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
79 else
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
80 if start >= 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
81 " produce previous range
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
82 call Range(ranges, start, end, step, add)
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
83 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
84 let start = n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
85 let end = n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
86 let step = 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
87 let add = nl - n
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
88 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
89 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
90 endfor
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
91 if start >= 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
92 call Range(ranges, start, end, step, add)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
93 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
94
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
95 " New buffer to put the result in.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
96 new
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
97 exe "file to" . a:name
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
98 call setline(1, "static convertStruct to" . a:name . "[] =")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
99 call setline(2, "{")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
100 call append('$', ranges)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
101 call setline('$', getline('$')[:-2]) " remove last comma
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
102 call setline(line('$') + 1, "};")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
103 wincmd p
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
104 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
105
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
106 " Build the foldCase table in a new buffer.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
107 " Uses s:foldprops.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
108 func! BuildFoldTable()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
109 let start = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
110 let end = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
111 let step = 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
112 let add = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
113 let ranges = []
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
114 for p in s:foldprops
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
115 if p[1] == 'C' || p[1] == 'S'
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
116 let n = ('0x' . p[0]) + 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
117 let nl = ('0x' . p[2]) + 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
118 if start >= 0 && add == nl - n && (step == 0 || n - end == step)
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
119 " continue with same range.
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
120 let step = n - end
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
121 let end = n
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
122 else
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
123 if start >= 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
124 " produce previous range
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
125 call Range(ranges, start, end, step, add)
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
126 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
127 let start = n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
128 let end = n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
129 let step = 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
130 let add = nl - n
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
131 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
132 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
133 endfor
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
134 if start >= 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
135 call Range(ranges, start, end, step, add)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
136 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
137
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
138 " New buffer to put the result in.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
139 new
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
140 file foldCase
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
141 call setline(1, "static convertStruct foldCase[] =")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
142 call setline(2, "{")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
143 call append('$', ranges)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
144 call setline('$', getline('$')[:-2]) " remove last comma
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
145 call setline(line('$') + 1, "};")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
146 wincmd p
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
147 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
148
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
149 func! Range(ranges, start, end, step, add)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
150 let s = printf("\t{0x%x,0x%x,%d,%d},", a:start, a:end, a:step == 0 ? -1 : a:step, a:add)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
151 call add(a:ranges, s)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
152 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
153
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
154 " Build the combining table.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
155 " Uses s:dataprops.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
156 func! BuildCombiningTable()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
157 let start = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
158 let end = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
159 let ranges = []
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
160 for p in s:dataprops
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
161 if p[2] == 'Mn' || p[2] == 'Mc' || p[2] == 'Me'
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
162 let n = ('0x' . p[0]) + 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
163 if start >= 0 && end + 1 == n
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
164 " continue with same range.
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
165 let end = n
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
166 else
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
167 if start >= 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
168 " produce previous range
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
169 call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
170 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
171 let start = n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
172 let end = n
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
173 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
174 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
175 endfor
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
176 if start >= 0
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
177 call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
178 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
179
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
180 " New buffer to put the result in.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
181 new
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
182 file combining
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
183 call setline(1, " static struct interval combining[] =")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
184 call setline(2, " {")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
185 call append('$', ranges)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
186 call setline('$', getline('$')[:-2]) " remove last comma
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
187 call setline(line('$') + 1, " };")
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
188 wincmd p
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
189 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
190
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
191 " Build the double width or ambiguous width table in a new buffer.
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
192 " Uses s:widthprops and s:dataprops.
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
193 func! BuildWidthTable(pattern, tableName)
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
194 let start = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
195 let end = -1
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
196 let ranges = []
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
197 let dataidx = 0
25062
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
198 " Account for indentation differences between ambiguous and doublewidth
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
199 " table in mbyte.c
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
200 if a:pattern == 'A'
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
201 let spc = ' '
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
202 else
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
203 let spc = "\t"
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
204 endif
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
205 for p in s:widthprops
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
206 if p[1][0] =~ a:pattern
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
207 if p[0] =~ '\.\.'
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
208 " It is a range. we don't check for composing char then.
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
209 let rng = split(p[0], '\.\.')
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
210 if len(rng) != 2
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
211 echoerr "Cannot parse range: '" . p[0] . "' in width table"
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
212 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
213 let n = ('0x' . rng[0]) + 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
214 let n_last = ('0x' . rng[1]) + 0
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
215 else
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
216 let n = ('0x' . p[0]) + 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
217 let n_last = n
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
218 endif
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
219 " Find this char in the data table.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
220 while 1
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
221 let dn = ('0x' . s:dataprops[dataidx][0]) + 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
222 if dn >= n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
223 break
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
224 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
225 let dataidx += 1
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
226 endwhile
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
227 if dn != n && n_last == n
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
228 echoerr "Cannot find character " . n . " in data table"
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
229 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
230 " Only use the char when it's not a composing char.
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
231 " But use all chars from a range.
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
232 let dp = s:dataprops[dataidx]
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
233 if n_last > n || (dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me')
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
234 if start >= 0 && end + 1 == n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
235 " continue with same range.
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
236 else
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
237 if start >= 0
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
238 " produce previous range
25062
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
239 call add(ranges, printf("%s{0x%04x, 0x%04x},", spc, start, end))
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
240 if a:pattern == 'A'
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
241 call add(s:ambitable, [start, end])
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
242 else
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
243 call add(s:doubletable, [start, end])
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
244 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
245 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
246 let start = n
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
247 endif
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
248 let end = n_last
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
249 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
250 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
251 endfor
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
252 if start >= 0
25062
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
253 call add(ranges, printf("%s{0x%04x, 0x%04x},", spc, start, end))
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
254 if a:pattern == 'A'
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
255 call add(s:ambitable, [start, end])
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
256 else
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
257 call add(s:doubletable, [start, end])
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
258 endif
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
259 endif
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
260
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
261 " New buffer to put the result in.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
262 new
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
263 exe "file " . a:tableName
25062
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
264 if a:pattern == 'A'
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
265 call setline(1, "static struct interval " . a:tableName . "[] =")
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
266 call setline(2, "{")
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
267 else
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
268 call setline(1, " static struct interval " . a:tableName . "[] =")
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
269 call setline(2, " {")
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
270 endif
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
271 call append('$', ranges)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
272 call setline('$', getline('$')[:-2]) " remove last comma
25062
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
273 if a:pattern == 'A'
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
274 call setline(line('$') + 1, "};")
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
275 else
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
276 call setline(line('$') + 1, " };")
042560a16d4e patch 8.2.3068: Unicode tables are slightly outdated
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
277 endif
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
278 wincmd p
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
279 endfunc
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
280
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
281
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
282 " Get characters from a list of lines in form "12ab .." or "12ab..56cd ..."
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
283 " and put them in dictionary "chardict"
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
284 func AddLinesToCharDict(lines, chardict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
285 for line in a:lines
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
286 let tokens = split(line, '\.\.')
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
287 let first = str2nr(tokens[0], 16)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
288 if len(tokens) == 1
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
289 let last = first
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
290 else
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
291 let last = str2nr(tokens[1], 16)
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
292 endif
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
293 for nr in range(first, last)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
294 let a:chardict[nr] = 1
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
295 endfor
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
296 endfor
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
297 endfunc
8706
f63892cfe283 commit https://github.com/vim/vim/commit/6a08454b93784c92296d4c08456401cbaa74c9d5
Christian Brabandt <cb@256bit.org>
parents: 8680
diff changeset
298
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
299 func Test_AddLinesToCharDict()
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
300 let dict = {}
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
301 call AddLinesToCharDict([
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
302 \ '1234 blah blah',
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
303 \ '1235 blah blah',
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
304 \ '12a0..12a2 blah blah',
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
305 \ '12a1 blah blah',
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
306 \ ], dict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
307 call assert_equal({0x1234: 1, 0x1235: 1,
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
308 \ 0x12a0: 1, 0x12a1: 1, 0x12a2: 1,
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
309 \ }, dict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
310 if v:errors != []
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
311 echoerr 'AddLinesToCharDict' v:errors
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
312 return 1
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
313 endif
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
314 return 0
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
315 endfunc
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
316
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
317
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
318 func CharDictToPairList(chardict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
319 let result = []
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
320 let keys = keys(a:chardict)->map('str2nr(v:val)')->sort('N')
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
321 let low = keys[0]
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
322 let high = keys[0]
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
323 for key in keys
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
324 if key > high + 1
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
325 call add(result, [low, high])
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
326 let low = key
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
327 let high = key
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
328 else
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
329 let high = key
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
330 endif
8629
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
331 endfor
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
332 call add(result, [low, high])
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
333 return result
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
334 endfunc
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
335
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
336 func Test_CharDictToPairList()
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
337 let dict = {0x1020: 1, 0x1021: 1, 0x1022: 1,
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
338 \ 0x1024: 1,
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
339 \ 0x2022: 1,
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
340 \ 0x2024: 1, 0x2025: 1}
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
341 call assert_equal([
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
342 \ [0x1020, 0x1022],
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
343 \ [0x1024, 0x1024],
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
344 \ [0x2022, 0x2022],
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
345 \ [0x2024, 0x2025],
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
346 \ ], CharDictToPairList(dict))
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
347 if v:errors != []
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
348 echoerr 'CharDictToPairList' v:errors
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
349 return 1
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
350 endif
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
351 return 0
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
352 endfunc
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
353
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
354
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
355 " Build the amoji width table in a new buffer.
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
356 func BuildEmojiTable()
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
357 " First make the table for all emojis.
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
358 let pattern = '; Emoji\s\+#\s'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
359 let lines = map(filter(filter(getline(1, '$'), 'v:val=~"^[1-9]"'), 'v:val=~pattern'), 'matchstr(v:val,"^\\S\\+")')
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
360
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
361 " Make a dictionary with an entry for each character.
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
362 let chardict = {}
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
363 call AddLinesToCharDict(lines, chardict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
364 let pairlist = CharDictToPairList(chardict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
365 let allranges = map(pairlist, 'printf(" {0x%04x, 0x%04x},", v:val[0], v:val[1])')
8629
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
366
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
367 " New buffer to put the result in.
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
368 new
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
369 exe 'file emoji_all'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
370 call setline(1, "static struct interval emoji_all[] =")
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
371 call setline(2, "{")
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
372 call append('$', allranges)
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
373 call setline('$', getline('$')[:-2]) " remove last comma
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
374 call setline(line('$') + 1, "};")
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
375 wincmd p
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
376
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
377 " Make the table for wide emojis.
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
378 let pattern = '; Emoji_\(Presentation\|Modifier_Base\)\s\+#\s'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
379 let lines = map(filter(filter(getline(1, '$'), 'v:val=~"^[1-9]"'), 'v:val=~pattern'), 'matchstr(v:val,"^\\S\\+")')
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
380
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
381 " Make a dictionary with an entry for each character.
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
382 let chardict = {}
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
383 call AddLinesToCharDict(lines, chardict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
384
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
385 " exclude characters that are in the "ambiguous" or "doublewidth" table
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
386 for ambi in s:ambitable
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
387 for nr in range(ambi[0], ambi[1])
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
388 if has_key(chardict, nr)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
389 call remove(chardict, nr)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
390 endif
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
391 endfor
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
392 endfor
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
393
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
394 for wide in s:doubletable
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
395 for nr in range(wide[0], wide[1])
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
396 if has_key(chardict, nr)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
397 call remove(chardict, nr)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
398 endif
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
399 endfor
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
400 endfor
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
401
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
402 let pairlist = CharDictToPairList(chardict)
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
403 let wide_ranges = map(pairlist, 'printf("\t{0x%04x, 0x%04x},", v:val[0], v:val[1])')
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
404
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
405 " New buffer to put the result in.
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
406 new
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
407 exe 'file emoji_wide'
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
408 call setline(1, " static struct interval emoji_wide[] =")
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
409 call setline(2, " {")
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
410 call append('$', wide_ranges)
8629
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
411 call setline('$', getline('$')[:-2]) " remove last comma
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
412 call setline(line('$') + 1, " };")
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
413 wincmd p
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
414 endfunc
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
415
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
416 " First test a few things
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
417 let v:errors = []
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
418 if Test_AddLinesToCharDict() || Test_CharDictToPairList()
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
419 finish
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
420 endif
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
421
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
422
6864
c9a5d51c9161 patch 7.4.752
Bram Moolenaar <bram@vim.org>
parents: 2063
diff changeset
423 " Try to avoid hitting E36
c9a5d51c9161 patch 7.4.752
Bram Moolenaar <bram@vim.org>
parents: 2063
diff changeset
424 set equalalways
2041
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
425
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
426 " Edit the Unicode text file. Requires the netrw plugin.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
427 edit http://unicode.org/Public/UNIDATA/UnicodeData.txt
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
428
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
429 " Parse each line, create a list of lists.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
430 call ParseDataToProps()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
431
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
432 " Build the toLower table.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
433 call BuildCaseTable("Lower", 13)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
434
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
435 " Build the toUpper table.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
436 call BuildCaseTable("Upper", 12)
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
437
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
438 " Build the ranges of composing chars.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
439 call BuildCombiningTable()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
440
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
441 " Edit the case folding text file. Requires the netrw plugin.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
442 edit http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
443
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
444 " Parse each line, create a list of lists.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
445 call ParseFoldProps()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
446
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
447 " Build the foldCase table.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
448 call BuildFoldTable()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
449
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
450 " Edit the width text file. Requires the netrw plugin.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
451 edit http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
452
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
453 " Parse each line, create a list of lists.
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
454 call ParseWidthProps()
d5867fd6b2b7 updated for version 7.2.330
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
455
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
456 " Build the double width table.
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
457 let s:doubletable = []
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
458 call BuildWidthTable('[WF]', 'doublewidth')
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
459
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
460 " Build the ambiguous width table.
8680
131e651fb347 commit https://github.com/vim/vim/commit/b86f10ee10bdf932df02bdaf601dffa671518a47
Christian Brabandt <cb@256bit.org>
parents: 8629
diff changeset
461 let s:ambitable = []
2063
1378bc45ebe5 updated for version 7.2.348
Bram Moolenaar <bram@zimbu.org>
parents: 2041
diff changeset
462 call BuildWidthTable('A', 'ambiguous')
8629
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
463
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
464 " Edit the emoji text file. Requires the netrw plugin.
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
465 edit https://unicode.org/Public/emoji/12.1/emoji-data.txt
8629
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
466
54ac275e3fc4 commit https://github.com/vim/vim/commit/3848e00e0177abdb31bc600234967863ec487233
Christian Brabandt <cb@256bit.org>
parents: 6864
diff changeset
467 " Build the emoji table. Ver. 1.0 - 6.0
21991
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
468 " Must come after the "ambiguous" and "doublewidth" tables
bbca88cd13d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14347
diff changeset
469 call BuildEmojiTable()