]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.348
- new
[packages/vim.git] / 7.2.348
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.348 (after 7.2.330)
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
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
14
15
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
18 ***************
19 *** 187,202 ****
20     wincmd p
21   endfunc
22   
23 ! " Build the ambiguous table in a new buffer.
24   " Uses s:widthprops and s:dataprops.
25 ! func! BuildAmbiguousTable()
26     let start = -1
27     let end = -1
28     let ranges = []
29     let dataidx = 0
30     for p in s:widthprops
31 !     if p[1][0] == 'A'
32 !       let n = ('0x' . p[0]) + 0
33         " Find this char in the data table.
34         while 1
35         let dn = ('0x' . s:dataprops[dataidx][0]) + 0
36 --- 187,213 ----
37     wincmd p
38   endfunc
39   
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)
43     let start = -1
44     let end = -1
45     let ranges = []
46     let dataidx = 0
47     for p in s:widthprops
48 !     if p[1][0] =~ a:pattern
49 !       if p[0] =~ '\.\.'
50 !       " It is a range.  we don't check for composing char then.
51 !       let rng = split(p[0], '\.\.')
52 !       if len(rng) != 2
53 !         echoerr "Cannot parse range: '" . p[0] . "' in width table"
54 !       endif
55 !       let n = ('0x' . rng[0]) + 0
56 !       let n_last =  ('0x' . rng[1]) + 0
57 !       else
58 !       let n = ('0x' . p[0]) + 0
59 !       let n_last = n
60 !       endif
61         " Find this char in the data table.
62         while 1
63         let dn = ('0x' . s:dataprops[dataidx][0]) + 0
64 ***************
65 *** 205,231 ****
66         endif
67         let dataidx += 1
68         endwhile
69 !       if dn != n
70         echoerr "Cannot find character " . n . " in data table"
71         endif
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.
77 -         let end = n
78         else
79           if start >= 0
80             " produce previous range
81             call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
82           endif
83           let start = n
84 -         if p[0] =~ '\.\.'
85 -           let end = ('0x' . substitute(p[0], '.*\.\.', '', '')) + 0
86 -         else
87 -           let end = n
88 -         endif
89         endif
90         endif
91       endif
92     endfor
93 --- 216,238 ----
94         endif
95         let dataidx += 1
96         endwhile
97 !       if dn != n && n_last == n
98         echoerr "Cannot find character " . n . " in data table"
99         endif
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.
106         else
107           if start >= 0
108             " produce previous range
109             call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
110           endif
111           let start = n
112         endif
113 +       let end = n_last
114         endif
115       endif
116     endfor
117 ***************
118 *** 235,242 ****
119   
120     " New buffer to put the result in.
121     new
122 !   file ambiguous
123 !   call setline(1, "    static struct interval ambiguous[] =")
124     call setline(2, "    {")
125     call append('$', ranges)
126     call setline('$', getline('$')[:-2])  " remove last comma
127 --- 242,249 ----
128   
129     " New buffer to put the result in.
130     new
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
136 ***************
137 *** 276,280 ****
138   " Parse each line, create a list of lists.
139   call ParseWidthProps()
140   
141 ! " Build the ambiguous table.
142 ! call BuildAmbiguousTable()
143 --- 283,290 ----
144   " Parse each line, create a list of lists.
145   call ParseWidthProps()
146   
147 ! " Build the double width table.
148 ! call BuildWidthTable('[WF]', 'doublewidth')
149
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
154 ***************
155 *** 1200,1205 ****
156 --- 1200,1248 ----
157   utf_char2cells(c)
158       int               c;
159   {
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[] =
163 +     {
164 +       {0x1100, 0x115f},
165 +       {0x11a3, 0x11a7},
166 +       {0x11fa, 0x11ff},
167 +       {0x2329, 0x232a},
168 +       {0x2e80, 0x2e99},
169 +       {0x2e9b, 0x2ef3},
170 +       {0x2f00, 0x2fd5},
171 +       {0x2ff0, 0x2ffb},
172 +       {0x3000, 0x3029},
173 +       {0x3030, 0x303e},
174 +       {0x3041, 0x3096},
175 +       {0x309b, 0x30ff},
176 +       {0x3105, 0x312d},
177 +       {0x3131, 0x318e},
178 +       {0x3190, 0x31b7},
179 +       {0x31c0, 0x31e3},
180 +       {0x31f0, 0x321e},
181 +       {0x3220, 0x3247},
182 +       {0x3250, 0x32fe},
183 +       {0x3300, 0x4dbf},
184 +       {0x4e00, 0xa48c},
185 +       {0xa490, 0xa4c6},
186 +       {0xa960, 0xa97c},
187 +       {0xac00, 0xd7a3},
188 +       {0xd7b0, 0xd7c6},
189 +       {0xd7cb, 0xd7fb},
190 +       {0xf900, 0xfaff},
191 +       {0xfe10, 0xfe19},
192 +       {0xfe30, 0xfe52},
193 +       {0xfe54, 0xfe66},
194 +       {0xfe68, 0xfe6b},
195 +       {0xff01, 0xff60},
196 +       {0xffe0, 0xffe6},
197 +       {0x1f200, 0x1f200},
198 +       {0x1f210, 0x1f231},
199 +       {0x1f240, 0x1f248},
200 +       {0x20000, 0x2fffd},
201 +       {0x30000, 0x3fffd}
202 +     };
203       /* Sorted list of non-overlapping intervals of East Asian Ambiguous
204        * characters, generated with ../runtime/tools/unicode.vim. */
205       static struct interval ambiguous[] =
206 ***************
207 *** 1403,1422 ****
208   #else
209         if (!utf_printable(c))
210             return 6;           /* unprintable, displays <xxxx> */
211 !       if (c >= 0x1100
212 !           && (c <= 0x115f                     /* Hangul Jamo */
213 !               || c == 0x2329
214 !               || c == 0x232a
215 !               || (c >= 0x2e80 && c <= 0xa4cf
216 !                   && c != 0x303f)             /* CJK ... Yi */
217 !               || (c >= 0xac00 && c <= 0xd7a3) /* Hangul Syllables */
218 !               || (c >= 0xf900 && c <= 0xfaff) /* CJK Compatibility
219 !                                                  Ideographs */
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)))
225             return 2;
226   #endif
227       }
228 --- 1446,1452 ----
229   #else
230         if (!utf_printable(c))
231             return 6;           /* unprintable, displays <xxxx> */
232 !       if (intable(doublewidth, sizeof(doublewidth), c))
233             return 2;
234   #endif
235       }
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
238 ***************
239 *** 683,684 ****
240 --- 683,686 ----
241   {   /* Add new patch number below this line */
242 + /**/
243 +     348,
244   /**/
245
246 -- 
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
249      address.
250
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    ///
This page took 0.040888 seconds and 3 git commands to generate.