]>
Commit | Line | Data |
---|---|---|
d36b537e AF |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.3.002 | |
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 6.3.002 | |
11 | Problem: When using translated help files with non-ASCII latin1 characters | |
12 | in the first line the utf-8 detection is wrong. | |
13 | Solution: Properly detect utf-8 characters. When a mix of encodings is | |
14 | detected continue with the next language and avoid a "no matches" | |
15 | error because of "got_int" being set. Add the directory name to | |
16 | the error message for a duplicate tag. | |
17 | Files: src/ex_cmds.c | |
18 | ||
19 | ||
20 | *** ../vim-6.3.001/src/ex_cmds.c Wed Jun 9 14:56:26 2004 | |
21 | --- src/ex_cmds.c Thu Jun 10 21:08:05 2004 | |
22 | *************** | |
23 | *** 5300,5305 **** | |
24 | --- 5300,5306 ---- | |
25 | int utf8 = MAYBE; | |
26 | int this_utf8; | |
27 | int firstline; | |
28 | + int mix = FALSE; /* detected mixed encodings */ | |
29 | # endif | |
30 | ||
31 | /* | |
32 | *************** | |
33 | *** 5313,5319 **** | |
34 | EW_FILE|EW_SILENT) == FAIL | |
35 | || filecount == 0) | |
36 | { | |
37 | ! EMSG2("E151: No match: %s", NameBuff); | |
38 | return; | |
39 | } | |
40 | ||
41 | --- 5314,5321 ---- | |
42 | EW_FILE|EW_SILENT) == FAIL | |
43 | || filecount == 0) | |
44 | { | |
45 | ! if (!got_int) | |
46 | ! EMSG2("E151: No match: %s", NameBuff); | |
47 | return; | |
48 | } | |
49 | ||
50 | *************** | |
51 | *** 5377,5391 **** | |
52 | if (firstline) | |
53 | { | |
54 | /* Detect utf-8 file by a non-ASCII char in the first line. */ | |
55 | ! this_utf8 = FALSE; | |
56 | for (s = IObuff; *s != NUL; ++s) | |
57 | if (*s >= 0x80) | |
58 | this_utf8 = TRUE; | |
59 | ! if (utf8 == MAYBE) | |
60 | utf8 = this_utf8; | |
61 | else if (utf8 != this_utf8) | |
62 | { | |
63 | EMSG2(_("E670: Mix of help file encodings within a language: %s"), files[fi]); | |
64 | got_int = TRUE; | |
65 | } | |
66 | firstline = FALSE; | |
67 | --- 5379,5408 ---- | |
68 | if (firstline) | |
69 | { | |
70 | /* Detect utf-8 file by a non-ASCII char in the first line. */ | |
71 | ! this_utf8 = MAYBE; | |
72 | for (s = IObuff; *s != NUL; ++s) | |
73 | if (*s >= 0x80) | |
74 | + { | |
75 | + int l; | |
76 | + | |
77 | this_utf8 = TRUE; | |
78 | ! l = utf_ptr2len_check(s); | |
79 | ! if (l == 1) | |
80 | ! { | |
81 | ! /* Illegal UTF-8 byte sequence. */ | |
82 | ! this_utf8 = FALSE; | |
83 | ! break; | |
84 | ! } | |
85 | ! s += l - 1; | |
86 | ! } | |
87 | ! if (this_utf8 == MAYBE) /* only ASCII characters found */ | |
88 | ! this_utf8 = FALSE; | |
89 | ! if (utf8 == MAYBE) /* first file */ | |
90 | utf8 = this_utf8; | |
91 | else if (utf8 != this_utf8) | |
92 | { | |
93 | EMSG2(_("E670: Mix of help file encodings within a language: %s"), files[fi]); | |
94 | + mix = !got_int; | |
95 | got_int = TRUE; | |
96 | } | |
97 | firstline = FALSE; | |
98 | *************** | |
99 | *** 5463,5470 **** | |
100 | { | |
101 | *p2 = NUL; | |
102 | sprintf((char *)NameBuff, | |
103 | ! _("E154: Duplicate tag \"%s\" in file %s"), | |
104 | ! ((char_u **)ga.ga_data)[i], p2 + 1); | |
105 | EMSG(NameBuff); | |
106 | *p2 = '\t'; | |
107 | break; | |
108 | --- 5480,5487 ---- | |
109 | { | |
110 | *p2 = NUL; | |
111 | sprintf((char *)NameBuff, | |
112 | ! _("E154: Duplicate tag \"%s\" in file %s/%s"), | |
113 | ! ((char_u **)ga.ga_data)[i], dir, p2 + 1); | |
114 | EMSG(NameBuff); | |
115 | *p2 = '\t'; | |
116 | break; | |
117 | *************** | |
118 | *** 5502,5507 **** | |
119 | --- 5519,5528 ---- | |
120 | } | |
121 | } | |
122 | } | |
123 | + #ifdef FEAT_MBYTE | |
124 | + if (mix) | |
125 | + got_int = FALSE; /* continue with other languages */ | |
126 | + #endif | |
127 | ||
128 | for (i = 0; i < ga.ga_len; ++i) | |
129 | vim_free(((char_u **)ga.ga_data)[i]); | |
130 | *** ../vim-6.3.001/src/version.c Wed Jun 9 14:59:11 2004 | |
131 | --- src/version.c Thu Jun 10 20:53:19 2004 | |
132 | *************** | |
133 | *** 643,644 **** | |
134 | --- 643,646 ---- | |
135 | { /* Add new patch number below this line */ | |
136 | + /**/ | |
137 | + 2, | |
138 | /**/ | |
139 | ||
140 | -- | |
141 | From "know your smileys": | |
142 | % Bike accident (a bit far-fetched, I suppose) | |
143 | ||
144 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
145 | /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
146 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
147 | \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html /// |