|
1 To: [email protected] |
|
2 Subject: Patch 7.2.090 |
|
3 Fcc: outbox |
|
4 From: Bram Moolenaar <[email protected]> |
|
5 Mime-Version: 1.0 |
|
6 Content-Type: text/plain; charset=ISO-8859-1 |
|
7 Content-Transfer-Encoding: 8bit |
|
8 ------------ |
|
9 |
|
10 Patch 7.2.090 |
|
11 Problem: User command containing 0x80 in multi-byte character does not work |
|
12 properly. (Yasuhiro Matsumoto) |
|
13 Solution: Undo replacement of K_SPECIAL and CSI characters when executing |
|
14 the command. |
|
15 Files: src/ex_docmd.c |
|
16 |
|
17 |
|
18 *** ../vim-7.2.089/src/ex_docmd.c Tue Dec 9 11:17:23 2008 |
|
19 --- src/ex_docmd.c Wed Jan 28 15:34:19 2009 |
|
20 *************** |
|
21 *** 5482,5487 **** |
|
22 --- 5482,5490 ---- |
|
23 return OK; |
|
24 } |
|
25 |
|
26 + /* |
|
27 + * ":command ..." |
|
28 + */ |
|
29 static void |
|
30 ex_command(eap) |
|
31 exarg_T *eap; |
|
32 *************** |
|
33 *** 5914,5919 **** |
|
34 --- 5917,5923 ---- |
|
35 |
|
36 char_u *start; |
|
37 char_u *end; |
|
38 + char_u *ksp; |
|
39 size_t len, totlen; |
|
40 |
|
41 size_t split_len = 0; |
|
42 *************** |
|
43 *** 5930,5945 **** |
|
44 |
|
45 /* |
|
46 * Replace <> in the command by the arguments. |
|
47 */ |
|
48 buf = NULL; |
|
49 for (;;) |
|
50 { |
|
51 ! p = cmd->uc_rep; |
|
52 ! q = buf; |
|
53 totlen = 0; |
|
54 ! while ((start = vim_strchr(p, '<')) != NULL |
|
55 ! && (end = vim_strchr(start + 1, '>')) != NULL) |
|
56 { |
|
57 /* Include the '>' */ |
|
58 ++end; |
|
59 |
|
60 --- 5934,5984 ---- |
|
61 |
|
62 /* |
|
63 * Replace <> in the command by the arguments. |
|
64 + * First round: "buf" is NULL, compute length, allocate "buf". |
|
65 + * Second round: copy result into "buf". |
|
66 */ |
|
67 buf = NULL; |
|
68 for (;;) |
|
69 { |
|
70 ! p = cmd->uc_rep; /* source */ |
|
71 ! q = buf; /* destinateion */ |
|
72 totlen = 0; |
|
73 ! |
|
74 ! for (;;) |
|
75 { |
|
76 + start = vim_strchr(p, '<'); |
|
77 + if (start != NULL) |
|
78 + end = vim_strchr(start + 1, '>'); |
|
79 + if (buf != NULL) |
|
80 + { |
|
81 + ksp = vim_strchr(p, K_SPECIAL); |
|
82 + if (ksp != NULL && (start == NULL || ksp < start || end == NULL) |
|
83 + && ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER) |
|
84 + # ifdef FEAT_GUI |
|
85 + || (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI) |
|
86 + # endif |
|
87 + )) |
|
88 + { |
|
89 + /* K_SPECIAL han been put in the buffer as K_SPECIAL |
|
90 + * KS_SPECIAL KE_FILLER, like for mappings, but |
|
91 + * do_cmdline() doesn't handle that, so convert it back. |
|
92 + * Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */ |
|
93 + len = ksp - p; |
|
94 + if (len > 0) |
|
95 + { |
|
96 + mch_memmove(q, p, len); |
|
97 + q += len; |
|
98 + } |
|
99 + *q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI; |
|
100 + p = ksp + 3; |
|
101 + continue; |
|
102 + } |
|
103 + } |
|
104 + |
|
105 + /* break if there no <item> is found */ |
|
106 + if (start == NULL || end == NULL) |
|
107 + break; |
|
108 + |
|
109 /* Include the '>' */ |
|
110 ++end; |
|
111 |
|
112 *** ../vim-7.2.089/src/version.c Wed Jan 28 14:17:21 2009 |
|
113 --- src/version.c Wed Jan 28 15:37:40 2009 |
|
114 *************** |
|
115 *** 678,679 **** |
|
116 --- 678,681 ---- |
|
117 { /* Add new patch number below this line */ |
|
118 + /**/ |
|
119 + 90, |
|
120 /**/ |
|
121 |
|
122 -- |
|
123 How To Keep A Healthy Level Of Insanity: |
|
124 17. When the money comes out the ATM, scream "I won!, I won! 3rd |
|
125 time this week!!!!!" |
|
126 |
|
127 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ |
|
128 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
|
129 \\\ download, build and distribute -- http://www.A-A-P.org /// |
|
130 \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |