2 Subject: Patch 7.2.348 (after 7.2.330)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
10 Patch 7.2.348 (after 7.2.330)
11 Problem: Unicode double-width characters are not up-to date.
12 Solution: Produce the double-width table like the others.
13 Files: runtime/tools/unicode.vim, src/mbyte.c
16 *** ../vim-7.2.347/runtime/tools/unicode.vim 2010-01-12 19:48:57.000000000 +0100
17 --- runtime/tools/unicode.vim 2010-01-27 17:57:17.000000000 +0100
23 ! " Build the ambiguous table in a new buffer.
24 " Uses s:widthprops and s:dataprops.
25 ! func! BuildAmbiguousTable()
32 ! let n = ('0x' . p[0]) + 0
33 " Find this char in the data table.
35 let dn = ('0x' . s:dataprops[dataidx][0]) + 0
40 ! " Build the double width or ambiguous width table in a new buffer.
41 " Uses s:widthprops and s:dataprops.
42 ! func! BuildWidthTable(pattern, tableName)
48 ! if p[1][0] =~ a:pattern
50 ! " It is a range. we don't check for composing char then.
51 ! let rng = split(p[0], '\.\.')
53 ! echoerr "Cannot parse range: '" . p[0] . "' in width table"
55 ! let n = ('0x' . rng[0]) + 0
56 ! let n_last = ('0x' . rng[1]) + 0
58 ! let n = ('0x' . p[0]) + 0
61 " Find this char in the data table.
63 let dn = ('0x' . s:dataprops[dataidx][0]) + 0
70 echoerr "Cannot find character " . n . " in data table"
72 " Only use the char when it's not a composing char.
73 let dp = s:dataprops[dataidx]
74 ! if dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me'
75 if start >= 0 && end + 1 == n
76 " continue with same range.
80 " produce previous range
81 call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
85 - let end = ('0x' . substitute(p[0], '.*\.\.', '', '')) + 0
97 ! if dn != n && n_last == n
98 echoerr "Cannot find character " . n . " in data table"
100 " Only use the char when it's not a composing char.
101 + " But use all chars from a range.
102 let dp = s:dataprops[dataidx]
103 ! if n_last > n || (dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me')
104 if start >= 0 && end + 1 == n
105 " continue with same range.
108 " produce previous range
109 call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
120 " New buffer to put the result in.
123 ! call setline(1, " static struct interval ambiguous[] =")
124 call setline(2, " {")
125 call append('$', ranges)
126 call setline('$', getline('$')[:-2]) " remove last comma
129 " New buffer to put the result in.
131 ! exe "file " . a:tableName
132 ! call setline(1, " static struct interval " . a:tableName . "[] =")
133 call setline(2, " {")
134 call append('$', ranges)
135 call setline('$', getline('$')[:-2]) " remove last comma
138 " Parse each line, create a list of lists.
139 call ParseWidthProps()
141 ! " Build the ambiguous table.
142 ! call BuildAmbiguousTable()
144 " Parse each line, create a list of lists.
145 call ParseWidthProps()
147 ! " Build the double width table.
148 ! call BuildWidthTable('[WF]', 'doublewidth')
150 ! " Build the ambiguous width table.
151 ! call BuildWidthTable('A', 'ambiguous')
152 *** ../vim-7.2.347/src/mbyte.c 2010-01-12 19:48:57.000000000 +0100
153 --- src/mbyte.c 2010-01-27 18:06:35.000000000 +0100
160 + /* Sorted list of non-overlapping intervals of East Asian double width
161 + * characters, generated with ../runtime/tools/unicode.vim. */
162 + static struct interval doublewidth[] =
197 + {0x1f200, 0x1f200},
198 + {0x1f210, 0x1f231},
199 + {0x1f240, 0x1f248},
200 + {0x20000, 0x2fffd},
203 /* Sorted list of non-overlapping intervals of East Asian Ambiguous
204 * characters, generated with ../runtime/tools/unicode.vim. */
205 static struct interval ambiguous[] =
209 if (!utf_printable(c))
210 return 6; /* unprintable, displays <xxxx> */
212 ! && (c <= 0x115f /* Hangul Jamo */
215 ! || (c >= 0x2e80 && c <= 0xa4cf
216 ! && c != 0x303f) /* CJK ... Yi */
217 ! || (c >= 0xac00 && c <= 0xd7a3) /* Hangul Syllables */
218 ! || (c >= 0xf900 && c <= 0xfaff) /* CJK Compatibility
220 ! || (c >= 0xfe30 && c <= 0xfe6f) /* CJK Compatibility Forms */
221 ! || (c >= 0xff00 && c <= 0xff60) /* Fullwidth Forms */
222 ! || (c >= 0xffe0 && c <= 0xffe6)
223 ! || (c >= 0x20000 && c <= 0x2fffd)
224 ! || (c >= 0x30000 && c <= 0x3fffd)))
230 if (!utf_printable(c))
231 return 6; /* unprintable, displays <xxxx> */
232 ! if (intable(doublewidth, sizeof(doublewidth), c))
236 *** ../vim-7.2.347/src/version.c 2010-01-27 17:31:38.000000000 +0100
237 --- src/version.c 2010-01-27 18:25:50.000000000 +0100
241 { /* Add new patch number below this line */
247 hundred-and-one symptoms of being an internet addict:
248 157. You fum through a magazine, you first check to see if it has a web
251 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
252 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
253 \\\ download, build and distribute -- http://www.A-A-P.org ///
254 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///