]>
Commit | Line | Data |
---|---|---|
6577e359 | 1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.061 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.061 | |
11 | Problem: Win32: When 'encoding' is "latin1" 'ignorecase' doesn't work for | |
12 | characters with umlaut. (Joachim Hofmann) | |
13 | Solution: Do not use islower()/isupper()/tolower()/toupper() but our own | |
14 | functions. (Chris Lubinski) | |
15 | Files: src/mbyte.c, src/regexp.c, src/vim.h | |
16 | ||
17 | ||
18 | *** ../vim-7.1.060/src/mbyte.c Thu May 10 19:45:20 2007 | |
19 | --- src/mbyte.c Sat Aug 4 13:44:36 2007 | |
20 | *************** | |
21 | *** 2320,2326 **** | |
22 | /* Single byte: first check normally, then with ignore case. */ | |
23 | if (s1[i] != s2[i]) | |
24 | { | |
25 | ! cdiff = TOLOWER_LOC(s1[i]) - TOLOWER_LOC(s2[i]); | |
26 | if (cdiff != 0) | |
27 | return cdiff; | |
28 | } | |
29 | --- 2320,2326 ---- | |
30 | /* Single byte: first check normally, then with ignore case. */ | |
31 | if (s1[i] != s2[i]) | |
32 | { | |
33 | ! cdiff = MB_TOLOWER(s1[i]) - MB_TOLOWER(s2[i]); | |
34 | if (cdiff != 0) | |
35 | return cdiff; | |
36 | } | |
37 | *** ../vim-7.1.060/src/regexp.c Mon Aug 6 22:27:13 2007 | |
38 | --- src/regexp.c Sun Aug 5 15:43:27 2007 | |
39 | *************** | |
40 | *** 2220,2226 **** | |
41 | break; | |
42 | case CLASS_LOWER: | |
43 | for (cu = 1; cu <= 255; cu++) | |
44 | ! if (islower(cu)) | |
45 | regc(cu); | |
46 | break; | |
47 | case CLASS_PRINT: | |
48 | --- 2220,2226 ---- | |
49 | break; | |
50 | case CLASS_LOWER: | |
51 | for (cu = 1; cu <= 255; cu++) | |
52 | ! if (MB_ISLOWER(cu)) | |
53 | regc(cu); | |
54 | break; | |
55 | case CLASS_PRINT: | |
56 | *************** | |
57 | *** 2240,2246 **** | |
58 | break; | |
59 | case CLASS_UPPER: | |
60 | for (cu = 1; cu <= 255; cu++) | |
61 | ! if (isupper(cu)) | |
62 | regc(cu); | |
63 | break; | |
64 | case CLASS_XDIGIT: | |
65 | --- 2240,2246 ---- | |
66 | break; | |
67 | case CLASS_UPPER: | |
68 | for (cu = 1; cu <= 255; cu++) | |
69 | ! if (MB_ISUPPER(cu)) | |
70 | regc(cu); | |
71 | break; | |
72 | case CLASS_XDIGIT: | |
73 | *************** | |
74 | *** 3465,3471 **** | |
75 | (enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) | |
76 | || (c < 255 && prog->regstart < 255 && | |
77 | #endif | |
78 | ! TOLOWER_LOC(prog->regstart) == TOLOWER_LOC(c))))) | |
79 | retval = regtry(prog, col); | |
80 | else | |
81 | retval = 0; | |
82 | --- 3465,3471 ---- | |
83 | (enc_utf8 && utf_fold(prog->regstart) == utf_fold(c))) | |
84 | || (c < 255 && prog->regstart < 255 && | |
85 | #endif | |
86 | ! MB_TOLOWER(prog->regstart) == MB_TOLOWER(c))))) | |
87 | retval = regtry(prog, col); | |
88 | else | |
89 | retval = 0; | |
90 | *************** | |
91 | *** 4200,4206 **** | |
92 | #ifdef FEAT_MBYTE | |
93 | !enc_utf8 && | |
94 | #endif | |
95 | ! TOLOWER_LOC(*opnd) != TOLOWER_LOC(*reginput)))) | |
96 | status = RA_NOMATCH; | |
97 | else if (*opnd == NUL) | |
98 | { | |
99 | --- 4200,4206 ---- | |
100 | #ifdef FEAT_MBYTE | |
101 | !enc_utf8 && | |
102 | #endif | |
103 | ! MB_TOLOWER(*opnd) != MB_TOLOWER(*reginput)))) | |
104 | status = RA_NOMATCH; | |
105 | else if (*opnd == NUL) | |
106 | { | |
107 | *************** | |
108 | *** 4733,4742 **** | |
109 | rst.nextb = *OPERAND(next); | |
110 | if (ireg_ic) | |
111 | { | |
112 | ! if (isupper(rst.nextb)) | |
113 | ! rst.nextb_ic = TOLOWER_LOC(rst.nextb); | |
114 | else | |
115 | ! rst.nextb_ic = TOUPPER_LOC(rst.nextb); | |
116 | } | |
117 | else | |
118 | rst.nextb_ic = rst.nextb; | |
119 | --- 4733,4742 ---- | |
120 | rst.nextb = *OPERAND(next); | |
121 | if (ireg_ic) | |
122 | { | |
123 | ! if (MB_ISUPPER(rst.nextb)) | |
124 | ! rst.nextb_ic = MB_TOLOWER(rst.nextb); | |
125 | else | |
126 | ! rst.nextb_ic = MB_TOUPPER(rst.nextb); | |
127 | } | |
128 | else | |
129 | rst.nextb_ic = rst.nextb; | |
130 | *************** | |
131 | *** 5558,5568 **** | |
132 | int cu, cl; | |
133 | ||
134 | /* This doesn't do a multi-byte character, because a MULTIBYTECODE | |
135 | ! * would have been used for it. */ | |
136 | if (ireg_ic) | |
137 | { | |
138 | ! cu = TOUPPER_LOC(*opnd); | |
139 | ! cl = TOLOWER_LOC(*opnd); | |
140 | while (count < maxcount && (*scan == cu || *scan == cl)) | |
141 | { | |
142 | count++; | |
143 | --- 5558,5569 ---- | |
144 | int cu, cl; | |
145 | ||
146 | /* This doesn't do a multi-byte character, because a MULTIBYTECODE | |
147 | ! * would have been used for it. It does handle single-byte | |
148 | ! * characters, such as latin1. */ | |
149 | if (ireg_ic) | |
150 | { | |
151 | ! cu = MB_TOUPPER(*opnd); | |
152 | ! cl = MB_TOLOWER(*opnd); | |
153 | while (count < maxcount && (*scan == cu || *scan == cl)) | |
154 | { | |
155 | count++; | |
156 | *************** | |
157 | *** 6490,6499 **** | |
158 | cc = utf_fold(c); | |
159 | else | |
160 | #endif | |
161 | ! if (isupper(c)) | |
162 | ! cc = TOLOWER_LOC(c); | |
163 | ! else if (islower(c)) | |
164 | ! cc = TOUPPER_LOC(c); | |
165 | else | |
166 | return vim_strchr(s, c); | |
167 | ||
168 | --- 6491,6500 ---- | |
169 | cc = utf_fold(c); | |
170 | else | |
171 | #endif | |
172 | ! if (MB_ISUPPER(c)) | |
173 | ! cc = MB_TOLOWER(c); | |
174 | ! else if (MB_ISLOWER(c)) | |
175 | ! cc = MB_TOUPPER(c); | |
176 | else | |
177 | return vim_strchr(s, c); | |
178 | ||
179 | *** ../vim-7.1.060/src/vim.h Sat May 12 15:08:22 2007 | |
180 | --- src/vim.h Sat Aug 4 13:57:36 2007 | |
181 | *************** | |
182 | *** 1380,1387 **** | |
183 | #endif | |
184 | ||
185 | #ifdef FEAT_MBYTE | |
186 | ! # define MB_STRICMP(d, s) (has_mbyte ? mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) : STRICMP((d), (s))) | |
187 | ! # define MB_STRNICMP(d, s, n) (has_mbyte ? mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) : STRNICMP((d), (s), (n))) | |
188 | #else | |
189 | # define MB_STRICMP(d, s) STRICMP((d), (s)) | |
190 | # define MB_STRNICMP(d, s, n) STRNICMP((d), (s), (n)) | |
191 | --- 1380,1393 ---- | |
192 | #endif | |
193 | ||
194 | #ifdef FEAT_MBYTE | |
195 | ! /* We need to call mb_stricmp() even when we aren't dealing with a multi-byte | |
196 | ! * encoding because mb_stricmp() takes care of all ascii and non-ascii | |
197 | ! * encodings, including characters with umluats in latin1, etc., while | |
198 | ! * STRICMP() only handles the system locale version, which often does not | |
199 | ! * handle non-ascii properly. */ | |
200 | ! | |
201 | ! # define MB_STRICMP(d, s) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) | |
202 | ! # define MB_STRNICMP(d, s, n) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) | |
203 | #else | |
204 | # define MB_STRICMP(d, s) STRICMP((d), (s)) | |
205 | # define MB_STRNICMP(d, s, n) STRNICMP((d), (s), (n)) | |
206 | *** ../vim-7.1.060/src/version.c Sat Aug 11 13:37:36 2007 | |
207 | --- src/version.c Sat Aug 11 13:55:24 2007 | |
208 | *************** | |
209 | *** 668,669 **** | |
210 | --- 668,671 ---- | |
211 | { /* Add new patch number below this line */ | |
212 | + /**/ | |
213 | + 61, | |
214 | /**/ | |
215 | ||
216 | -- | |
217 | Support your right to bare arms! Wear short sleeves! | |
218 | ||
219 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
220 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
221 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
222 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |