]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - vim/patches/vim-7.3.341.patch0
Merge remote-tracking branch 'stevee/openvswitch-systemd'
[people/amarx/ipfire-3.x.git] / vim / patches / vim-7.3.341.patch0
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.341
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.3.341
11 Problem: Local help files are only listed in help.txt, not in translated
12 help files.
13 Solution: Also find translated help files. (Yasuhiro Matsumoto)
14 Files: src/ex_cmds.c
15
16
17 *** ../vim-7.3.340/src/ex_cmds.c 2011-09-30 17:30:27.000000000 +0200
18 --- src/ex_cmds.c 2011-10-20 17:39:45.000000000 +0200
19 ***************
20 *** 5982,5987 ****
21 --- 5982,5988 ----
22 char_u *line;
23 int in_example = FALSE;
24 int len;
25 + char_u *fname;
26 char_u *p;
27 char_u *rt;
28 int mustfree;
29 ***************
30 *** 6028,6151 ****
31 }
32
33 /*
34 ! * In the "help.txt" file, add the locally added help files.
35 ! * This uses the very first line in the help file.
36 */
37 ! if (fnamecmp(gettail(curbuf->b_fname), "help.txt") == 0)
38 {
39 for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
40 {
41 line = ml_get_buf(curbuf, lnum, FALSE);
42 ! if (strstr((char *)line, "*local-additions*") != NULL)
43 {
44 ! /* Go through all directories in 'runtimepath', skipping
45 ! * $VIMRUNTIME. */
46 ! p = p_rtp;
47 ! while (*p != NUL)
48 {
49 ! copy_option_part(&p, NameBuff, MAXPATHL, ",");
50 ! mustfree = FALSE;
51 ! rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
52 ! if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME)
53 ! {
54 ! int fcount;
55 ! char_u **fnames;
56 ! FILE *fd;
57 ! char_u *s;
58 ! int fi;
59 #ifdef FEAT_MBYTE
60 ! vimconv_T vc;
61 ! char_u *cp;
62 #endif
63
64 ! /* Find all "doc/ *.txt" files in this directory. */
65 ! add_pathsep(NameBuff);
66 ! STRCAT(NameBuff, "doc/*.txt");
67 ! if (gen_expand_wildcards(1, &NameBuff, &fcount,
68 ! &fnames, EW_FILE|EW_SILENT) == OK
69 ! && fcount > 0)
70 {
71 ! for (fi = 0; fi < fcount; ++fi)
72 {
73 ! fd = mch_fopen((char *)fnames[fi], "r");
74 ! if (fd != NULL)
75 {
76 ! vim_fgets(IObuff, IOSIZE, fd);
77 ! if (IObuff[0] == '*'
78 ! && (s = vim_strchr(IObuff + 1, '*'))
79 ! != NULL)
80 ! {
81 ! #ifdef FEAT_MBYTE
82 ! int this_utf = MAYBE;
83 #endif
84 ! /* Change tag definition to a
85 ! * reference and remove <CR>/<NL>. */
86 ! IObuff[0] = '|';
87 ! *s = '|';
88 ! while (*s != NUL)
89 ! {
90 ! if (*s == '\r' || *s == '\n')
91 ! *s = NUL;
92 #ifdef FEAT_MBYTE
93 ! /* The text is utf-8 when a byte
94 ! * above 127 is found and no
95 ! * illegal byte sequence is found.
96 ! */
97 ! if (*s >= 0x80 && this_utf != FALSE)
98 ! {
99 ! int l;
100 !
101 ! this_utf = TRUE;
102 ! l = utf_ptr2len(s);
103 ! if (l == 1)
104 ! this_utf = FALSE;
105 ! s += l - 1;
106 ! }
107 #endif
108 ! ++s;
109 ! }
110 #ifdef FEAT_MBYTE
111 ! /* The help file is latin1 or utf-8;
112 ! * conversion to the current
113 ! * 'encoding' may be required. */
114 ! vc.vc_type = CONV_NONE;
115 ! convert_setup(&vc, (char_u *)(
116 ! this_utf == TRUE ? "utf-8"
117 ! : "latin1"), p_enc);
118 ! if (vc.vc_type == CONV_NONE)
119 ! /* No conversion needed. */
120 ! cp = IObuff;
121 ! else
122 {
123 ! /* Do the conversion. If it fails
124 ! * use the unconverted text. */
125 ! cp = string_convert(&vc, IObuff,
126 ! NULL);
127 ! if (cp == NULL)
128 ! cp = IObuff;
129 }
130 ! convert_setup(&vc, NULL, NULL);
131
132 ! ml_append(lnum, cp, (colnr_T)0, FALSE);
133 ! if (cp != IObuff)
134 ! vim_free(cp);
135 #else
136 ! ml_append(lnum, IObuff, (colnr_T)0,
137 ! FALSE);
138 #endif
139 ! ++lnum;
140 ! }
141 ! fclose(fd);
142 }
143 }
144 - FreeWild(fcount, fnames);
145 }
146 }
147 - if (mustfree)
148 - vim_free(rt);
149 }
150 ! break;
151 }
152 }
153 }
154 }
155 --- 6029,6215 ----
156 }
157
158 /*
159 ! * In the "help.txt" and "help.abx" file, add the locally added help
160 ! * files. This uses the very first line in the help file.
161 */
162 ! fname = gettail(curbuf->b_fname);
163 ! if (fnamecmp(fname, "help.txt") == 0
164 ! #ifdef FEAT_MULTI_LANG
165 ! || (fnamencmp(fname, "help.", 5) == 0
166 ! && ASCII_ISALPHA(fname[5])
167 ! && ASCII_ISALPHA(fname[6])
168 ! && TOLOWER_ASC(fname[7]) == 'x'
169 ! && fname[8] == NUL)
170 ! #endif
171 ! )
172 {
173 for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
174 {
175 line = ml_get_buf(curbuf, lnum, FALSE);
176 ! if (strstr((char *)line, "*local-additions*") == NULL)
177 ! continue;
178 !
179 ! /* Go through all directories in 'runtimepath', skipping
180 ! * $VIMRUNTIME. */
181 ! p = p_rtp;
182 ! while (*p != NUL)
183 {
184 ! copy_option_part(&p, NameBuff, MAXPATHL, ",");
185 ! mustfree = FALSE;
186 ! rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
187 ! if (fullpathcmp(rt, NameBuff, FALSE) != FPC_SAME)
188 {
189 ! int fcount;
190 ! char_u **fnames;
191 ! FILE *fd;
192 ! char_u *s;
193 ! int fi;
194 #ifdef FEAT_MBYTE
195 ! vimconv_T vc;
196 ! char_u *cp;
197 #endif
198
199 ! /* Find all "doc/ *.txt" files in this directory. */
200 ! add_pathsep(NameBuff);
201 ! #ifdef FEAT_MULTI_LANG
202 ! STRCAT(NameBuff, "doc/*.??[tx]");
203 ! #else
204 ! STRCAT(NameBuff, "doc/*.txt");
205 ! #endif
206 ! if (gen_expand_wildcards(1, &NameBuff, &fcount,
207 ! &fnames, EW_FILE|EW_SILENT) == OK
208 ! && fcount > 0)
209 ! {
210 ! #ifdef FEAT_MULTI_LANG
211 ! int i1;
212 ! int i2;
213 ! char_u *f1;
214 ! char_u *f2;
215 ! char_u *t1;
216 ! char_u *e1;
217 ! char_u *e2;
218 !
219 ! /* If foo.abx is found use it instead of foo.txt in
220 ! * the same directory. */
221 ! for (i1 = 0; i1 < fcount; ++i1)
222 {
223 ! for (i2 = 0; i2 < fcount; ++i2)
224 {
225 ! if (i1 == i2)
226 ! continue;
227 ! if (fnames[i1] == NULL || fnames[i2] == NULL)
228 ! continue;
229 ! f1 = fnames[i1];
230 ! f2 = fnames[i2];
231 ! t1 = gettail(f1);
232 ! if (fnamencmp(f1, f2, t1 - f1) != 0)
233 ! continue;
234 ! e1 = vim_strrchr(t1, '.');
235 ! e2 = vim_strrchr(gettail(f2), '.');
236 ! if (e1 == NUL || e2 == NUL)
237 ! continue;
238 ! if (fnamecmp(e1, ".txt") != 0
239 ! && fnamecmp(e1, fname + 4) != 0)
240 {
241 ! /* Not .txt and not .abx, remove it. */
242 ! vim_free(fnames[i1]);
243 ! fnames[i1] = NULL;
244 ! continue;
245 ! }
246 ! if (fnamencmp(f1, f2, e1 - f1) != 0)
247 ! continue;
248 ! if (fnamecmp(e1, ".txt") == 0
249 ! && fnamecmp(e2, fname + 4) == 0)
250 ! {
251 ! /* use .abx instead of .txt */
252 ! vim_free(fnames[i1]);
253 ! fnames[i1] = NULL;
254 ! }
255 ! }
256 ! }
257 #endif
258 ! for (fi = 0; fi < fcount; ++fi)
259 ! {
260 ! if (fnames[fi] == NULL)
261 ! continue;
262 ! fd = mch_fopen((char *)fnames[fi], "r");
263 ! if (fd != NULL)
264 ! {
265 ! vim_fgets(IObuff, IOSIZE, fd);
266 ! if (IObuff[0] == '*'
267 ! && (s = vim_strchr(IObuff + 1, '*'))
268 ! != NULL)
269 ! {
270 #ifdef FEAT_MBYTE
271 ! int this_utf = MAYBE;
272 #endif
273 ! /* Change tag definition to a
274 ! * reference and remove <CR>/<NL>. */
275 ! IObuff[0] = '|';
276 ! *s = '|';
277 ! while (*s != NUL)
278 ! {
279 ! if (*s == '\r' || *s == '\n')
280 ! *s = NUL;
281 #ifdef FEAT_MBYTE
282 ! /* The text is utf-8 when a byte
283 ! * above 127 is found and no
284 ! * illegal byte sequence is found.
285 ! */
286 ! if (*s >= 0x80 && this_utf != FALSE)
287 {
288 ! int l;
289 !
290 ! this_utf = TRUE;
291 ! l = utf_ptr2len(s);
292 ! if (l == 1)
293 ! this_utf = FALSE;
294 ! s += l - 1;
295 }
296 ! #endif
297 ! ++s;
298 ! }
299 ! #ifdef FEAT_MBYTE
300 ! /* The help file is latin1 or utf-8;
301 ! * conversion to the current
302 ! * 'encoding' may be required. */
303 ! vc.vc_type = CONV_NONE;
304 ! convert_setup(&vc, (char_u *)(
305 ! this_utf == TRUE ? "utf-8"
306 ! : "latin1"), p_enc);
307 ! if (vc.vc_type == CONV_NONE)
308 ! /* No conversion needed. */
309 ! cp = IObuff;
310 ! else
311 ! {
312 ! /* Do the conversion. If it fails
313 ! * use the unconverted text. */
314 ! cp = string_convert(&vc, IObuff,
315 ! NULL);
316 ! if (cp == NULL)
317 ! cp = IObuff;
318 ! }
319 ! convert_setup(&vc, NULL, NULL);
320
321 ! ml_append(lnum, cp, (colnr_T)0, FALSE);
322 ! if (cp != IObuff)
323 ! vim_free(cp);
324 #else
325 ! ml_append(lnum, IObuff, (colnr_T)0,
326 ! FALSE);
327 #endif
328 ! ++lnum;
329 }
330 + fclose(fd);
331 }
332 }
333 + FreeWild(fcount, fnames);
334 }
335 }
336 ! if (mustfree)
337 ! vim_free(rt);
338 }
339 + break;
340 }
341 }
342 }
343 *** ../vim-7.3.340/src/version.c 2011-10-20 18:12:27.000000000 +0200
344 --- src/version.c 2011-10-20 18:13:46.000000000 +0200
345 ***************
346 *** 711,712 ****
347 --- 711,714 ----
348 { /* Add new patch number below this line */
349 + /**/
350 + 341,
351 /**/
352
353 --
354 From "know your smileys":
355 :-)-O Smiling doctor with stethoscope
356
357 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
358 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
359 \\\ an exciting new programming language -- http://www.Zimbu.org ///
360 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///