]>
Commit | Line | Data |
---|---|---|
538ccef2 | 1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.273 | |
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.273 | |
11 | Problem: A BOM in an error file is seen as text. (Aleksey Baibarin) | |
12 | Solution: Remove the BOM from the text before evaluating. (idea by Christian | |
13 | Brabandt) | |
14 | Files: src/quickfix.c, src/mbyte.c, src/proto/mbyte.pro, | |
15 | src/testdir/test10.in | |
16 | ||
17 | ||
18 | *** ../vim-7.3.272/src/quickfix.c 2011-05-19 17:42:54.000000000 +0200 | |
19 | --- src/quickfix.c 2011-08-10 12:56:15.000000000 +0200 | |
20 | *************** | |
21 | *** 561,566 **** | |
22 | --- 561,570 ---- | |
23 | break; | |
24 | ||
25 | IObuff[CMDBUFFSIZE - 2] = NUL; /* for very long lines */ | |
26 | + #ifdef FEAT_MBYTE | |
27 | + remove_bom(IObuff); | |
28 | + #endif | |
29 | + | |
30 | if ((efmp = vim_strrchr(IObuff, '\n')) != NULL) | |
31 | *efmp = NUL; | |
32 | #ifdef USE_CRNL | |
33 | *** ../vim-7.3.272/src/mbyte.c 2011-07-27 18:25:40.000000000 +0200 | |
34 | --- src/mbyte.c 2011-08-10 13:11:56.000000000 +0200 | |
35 | *************** | |
36 | *** 838,843 **** | |
37 | --- 838,864 ---- | |
38 | } | |
39 | ||
40 | /* | |
41 | + * Remove all BOM from "s" by moving remaining text. | |
42 | + */ | |
43 | + void | |
44 | + remove_bom(s) | |
45 | + char_u *s; | |
46 | + { | |
47 | + if (enc_utf8) | |
48 | + { | |
49 | + char_u *p = s; | |
50 | + | |
51 | + while ((p = vim_strbyte(p, 0xef)) != NULL) | |
52 | + { | |
53 | + if (p[1] == 0xbb && p[2] == 0xbf) | |
54 | + STRMOVE(p, p + 3); | |
55 | + else | |
56 | + ++p; | |
57 | + } | |
58 | + } | |
59 | + } | |
60 | + | |
61 | + /* | |
62 | * Get class of pointer: | |
63 | * 0 for blank or NUL | |
64 | * 1 for punctuation | |
65 | *** ../vim-7.3.272/src/proto/mbyte.pro 2011-07-07 15:08:53.000000000 +0200 | |
66 | --- src/proto/mbyte.pro 2011-08-10 12:50:44.000000000 +0200 | |
67 | *************** | |
68 | *** 2,7 **** | |
69 | --- 2,8 ---- | |
70 | int enc_canon_props __ARGS((char_u *name)); | |
71 | char_u *mb_init __ARGS((void)); | |
72 | int bomb_size __ARGS((void)); | |
73 | + void remove_bom __ARGS((char_u *s)); | |
74 | int mb_get_class __ARGS((char_u *p)); | |
75 | int dbcs_class __ARGS((unsigned lead, unsigned trail)); | |
76 | int latin_char2len __ARGS((int c)); | |
77 | *** ../vim-7.3.272/src/testdir/test10.in 2010-08-15 21:57:29.000000000 +0200 | |
78 | --- src/testdir/test10.in 2011-08-10 13:01:46.000000000 +0200 | |
79 | *************** | |
80 | *** 2,7 **** | |
81 | --- 2,10 ---- | |
82 | ||
83 | STARTTEST | |
84 | :so small.vim | |
85 | + :" Also test a BOM is ignored. | |
86 | + :so mbyte.vim | |
87 | + :set encoding=utf-8 | |
88 | :/start of errorfile/,/end of errorfile/w! Xerrorfile | |
89 | :/start of testfile/,/end of testfile/w! Xtestfile | |
90 | :cf Xerrorfile | |
91 | *************** | |
92 | *** 20,26 **** | |
93 | ||
94 | start of errorfile | |
95 | "Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set. | |
96 | ! "Xtestfile", line 7 col 19; this is an error | |
97 | gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c | |
98 | Xtestfile:13: parse error before `asd' | |
99 | make: *** [vim] Error 1 | |
100 | --- 23,29 ---- | |
101 | ||
102 | start of errorfile | |
103 | "Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set. | |
104 | ! "Xtestfile", line 7 col 19; this is an error | |
105 | gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c | |
106 | Xtestfile:13: parse error before `asd' | |
107 | make: *** [vim] Error 1 | |
108 | *** ../vim-7.3.272/src/version.c 2011-08-10 12:38:02.000000000 +0200 | |
109 | --- src/version.c 2011-08-10 13:14:35.000000000 +0200 | |
110 | *************** | |
111 | *** 711,712 **** | |
112 | --- 711,714 ---- | |
113 | { /* Add new patch number below this line */ | |
114 | + /**/ | |
115 | + 273, | |
116 | /**/ | |
117 | ||
118 | -- | |
119 | Compilation process failed successfully. | |
120 | ||
121 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
122 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
123 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
124 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |