]>
Commit | Line | Data |
---|---|---|
0035583b ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.091 | |
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.091 | |
11 | Problem: "vim -w foo" writes special key codes for removed escape | |
12 | sequences. (Josh Triplett) | |
13 | Solution: Don't write K_IGNORE codes. | |
14 | Files: src/getchar.c, src/misc1.c, src/term.c, src/vim.h | |
15 | ||
16 | ||
17 | *** ../vim-7.3.090/src/getchar.c 2010-10-27 17:39:00.000000000 +0200 | |
18 | --- src/getchar.c 2010-12-30 12:16:36.000000000 +0100 | |
19 | *************** | |
20 | *** 1506,1514 **** | |
21 | } | |
22 | } | |
23 | ||
24 | - #define KL_PART_KEY -1 /* keylen value for incomplete key-code */ | |
25 | - #define KL_PART_MAP -2 /* keylen value for incomplete mapping */ | |
26 | - | |
27 | /* | |
28 | * Get the next input character. | |
29 | * Can return a special key or a multi-byte character. | |
30 | --- 1506,1511 ---- | |
31 | *************** | |
32 | *** 2171,2177 **** | |
33 | if (!timedout) | |
34 | { | |
35 | /* break at a partly match */ | |
36 | ! keylen = KL_PART_MAP; | |
37 | break; | |
38 | } | |
39 | } | |
40 | --- 2168,2174 ---- | |
41 | if (!timedout) | |
42 | { | |
43 | /* break at a partly match */ | |
44 | ! keylen = KEYLEN_PART_MAP; | |
45 | break; | |
46 | } | |
47 | } | |
48 | *************** | |
49 | *** 2192,2198 **** | |
50 | ||
51 | /* If no partly match found, use the longest full | |
52 | * match. */ | |
53 | ! if (keylen != KL_PART_MAP) | |
54 | { | |
55 | mp = mp_match; | |
56 | keylen = mp_match_len; | |
57 | --- 2189,2195 ---- | |
58 | ||
59 | /* If no partly match found, use the longest full | |
60 | * match. */ | |
61 | ! if (keylen != KEYLEN_PART_MAP) | |
62 | { | |
63 | mp = mp_match; | |
64 | keylen = mp_match_len; | |
65 | *************** | |
66 | *** 2230,2236 **** | |
67 | } | |
68 | /* Need more chars for partly match. */ | |
69 | if (mlen == typebuf.tb_len) | |
70 | ! keylen = KL_PART_KEY; | |
71 | else if (max_mlen < mlen) | |
72 | /* no match, may have to check for termcode at | |
73 | * next character */ | |
74 | --- 2227,2233 ---- | |
75 | } | |
76 | /* Need more chars for partly match. */ | |
77 | if (mlen == typebuf.tb_len) | |
78 | ! keylen = KEYLEN_PART_KEY; | |
79 | else if (max_mlen < mlen) | |
80 | /* no match, may have to check for termcode at | |
81 | * next character */ | |
82 | *************** | |
83 | *** 2238,2244 **** | |
84 | } | |
85 | ||
86 | if ((mp == NULL || max_mlen >= mp_match_len) | |
87 | ! && keylen != KL_PART_MAP) | |
88 | { | |
89 | int save_keylen = keylen; | |
90 | ||
91 | --- 2235,2241 ---- | |
92 | } | |
93 | ||
94 | if ((mp == NULL || max_mlen >= mp_match_len) | |
95 | ! && keylen != KEYLEN_PART_MAP) | |
96 | { | |
97 | int save_keylen = keylen; | |
98 | ||
99 | *************** | |
100 | *** 2264,2271 **** | |
101 | /* If no termcode matched but 'pastetoggle' | |
102 | * matched partially it's like an incomplete key | |
103 | * sequence. */ | |
104 | ! if (keylen == 0 && save_keylen == KL_PART_KEY) | |
105 | ! keylen = KL_PART_KEY; | |
106 | ||
107 | /* | |
108 | * When getting a partial match, but the last | |
109 | --- 2261,2268 ---- | |
110 | /* If no termcode matched but 'pastetoggle' | |
111 | * matched partially it's like an incomplete key | |
112 | * sequence. */ | |
113 | ! if (keylen == 0 && save_keylen == KEYLEN_PART_KEY) | |
114 | ! keylen = KEYLEN_PART_KEY; | |
115 | ||
116 | /* | |
117 | * When getting a partial match, but the last | |
118 | *************** | |
119 | *** 2302,2308 **** | |
120 | continue; | |
121 | } | |
122 | if (*s == NUL) /* need more characters */ | |
123 | ! keylen = KL_PART_KEY; | |
124 | } | |
125 | if (keylen >= 0) | |
126 | #endif | |
127 | --- 2299,2305 ---- | |
128 | continue; | |
129 | } | |
130 | if (*s == NUL) /* need more characters */ | |
131 | ! keylen = KEYLEN_PART_KEY; | |
132 | } | |
133 | if (keylen >= 0) | |
134 | #endif | |
135 | *************** | |
136 | *** 2339,2345 **** | |
137 | if (keylen > 0) /* full matching terminal code */ | |
138 | { | |
139 | #if defined(FEAT_GUI) && defined(FEAT_MENU) | |
140 | ! if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL | |
141 | && typebuf.tb_buf[typebuf.tb_off + 1] | |
142 | == KS_MENU) | |
143 | { | |
144 | --- 2336,2343 ---- | |
145 | if (keylen > 0) /* full matching terminal code */ | |
146 | { | |
147 | #if defined(FEAT_GUI) && defined(FEAT_MENU) | |
148 | ! if (typebuf.tb_len >= 2 | |
149 | ! && typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL | |
150 | && typebuf.tb_buf[typebuf.tb_off + 1] | |
151 | == KS_MENU) | |
152 | { | |
153 | *************** | |
154 | *** 2381,2387 **** | |
155 | /* Partial match: get some more characters. When a | |
156 | * matching mapping was found use that one. */ | |
157 | if (mp == NULL || keylen < 0) | |
158 | ! keylen = KL_PART_KEY; | |
159 | else | |
160 | keylen = mp_match_len; | |
161 | } | |
162 | --- 2379,2385 ---- | |
163 | /* Partial match: get some more characters. When a | |
164 | * matching mapping was found use that one. */ | |
165 | if (mp == NULL || keylen < 0) | |
166 | ! keylen = KEYLEN_PART_KEY; | |
167 | else | |
168 | keylen = mp_match_len; | |
169 | } | |
170 | *************** | |
171 | *** 2553,2559 **** | |
172 | #endif | |
173 | && typebuf.tb_maplen == 0 | |
174 | && (State & INSERT) | |
175 | ! && (p_timeout || (keylen == KL_PART_KEY && p_ttimeout)) | |
176 | && (c = inchar(typebuf.tb_buf + typebuf.tb_off | |
177 | + typebuf.tb_len, 3, 25L, | |
178 | typebuf.tb_change_cnt)) == 0) | |
179 | --- 2551,2558 ---- | |
180 | #endif | |
181 | && typebuf.tb_maplen == 0 | |
182 | && (State & INSERT) | |
183 | ! && (p_timeout | |
184 | ! || (keylen == KEYLEN_PART_KEY && p_ttimeout)) | |
185 | && (c = inchar(typebuf.tb_buf + typebuf.tb_off | |
186 | + typebuf.tb_len, 3, 25L, | |
187 | typebuf.tb_change_cnt)) == 0) | |
188 | *************** | |
189 | *** 2783,2791 **** | |
190 | ? 0 | |
191 | : ((typebuf.tb_len == 0 | |
192 | || !(p_timeout || (p_ttimeout | |
193 | ! && keylen == KL_PART_KEY))) | |
194 | ? -1L | |
195 | ! : ((keylen == KL_PART_KEY && p_ttm >= 0) | |
196 | ? p_ttm | |
197 | : p_tm)), typebuf.tb_change_cnt); | |
198 | ||
199 | --- 2782,2790 ---- | |
200 | ? 0 | |
201 | : ((typebuf.tb_len == 0 | |
202 | || !(p_timeout || (p_ttimeout | |
203 | ! && keylen == KEYLEN_PART_KEY))) | |
204 | ? -1L | |
205 | ! : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0) | |
206 | ? p_ttm | |
207 | : p_tm)), typebuf.tb_change_cnt); | |
208 | ||
209 | *** ../vim-7.3.090/src/misc1.c 2010-12-02 16:01:23.000000000 +0100 | |
210 | --- src/misc1.c 2010-12-30 12:28:59.000000000 +0100 | |
211 | *************** | |
212 | *** 3114,3123 **** | |
213 | && (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm))) | |
214 | continue; | |
215 | ||
216 | ! /* found a termcode: adjust length */ | |
217 | ! if (n > 0) | |
218 | len = n; | |
219 | ! if (len == 0) /* nothing typed yet */ | |
220 | continue; | |
221 | ||
222 | /* Handle modifier and/or special key code. */ | |
223 | --- 3114,3124 ---- | |
224 | && (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm))) | |
225 | continue; | |
226 | ||
227 | ! if (n == KEYLEN_REMOVED) /* key code removed */ | |
228 | ! continue; | |
229 | ! if (n > 0) /* found a termcode: adjust length */ | |
230 | len = n; | |
231 | ! if (len == 0) /* nothing typed yet */ | |
232 | continue; | |
233 | ||
234 | /* Handle modifier and/or special key code. */ | |
235 | *** ../vim-7.3.090/src/term.c 2010-08-15 21:57:32.000000000 +0200 | |
236 | --- src/term.c 2010-12-30 12:14:48.000000000 +0100 | |
237 | *************** | |
238 | *** 3828,3833 **** | |
239 | --- 3831,3837 ---- | |
240 | * Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off | |
241 | * + max_offset]. | |
242 | * Return 0 for no match, -1 for partial match, > 0 for full match. | |
243 | + * Return KEYLEN_REMOVED when a key code was deleted. | |
244 | * With a match, the match is removed, the replacement code is inserted in | |
245 | * typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is | |
246 | * returned. | |
247 | *************** | |
248 | *** 3845,3850 **** | |
249 | --- 3849,3855 ---- | |
250 | int slen = 0; /* init for GCC */ | |
251 | int modslen; | |
252 | int len; | |
253 | + int retval = 0; | |
254 | int offset; | |
255 | char_u key_name[2]; | |
256 | int modifiers; | |
257 | *************** | |
258 | *** 4940,4945 **** | |
259 | --- 4945,4957 ---- | |
260 | #endif | |
261 | string[new_slen++] = key_name[1]; | |
262 | } | |
263 | + else if (new_slen == 0 && key_name[0] == KS_EXTRA | |
264 | + && key_name[1] == KE_IGNORE) | |
265 | + { | |
266 | + /* Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED | |
267 | + * to indicate what happened. */ | |
268 | + retval = KEYLEN_REMOVED; | |
269 | + } | |
270 | else | |
271 | { | |
272 | string[new_slen++] = K_SPECIAL; | |
273 | *************** | |
274 | *** 4976,4982 **** | |
275 | (size_t)(buflen - offset)); | |
276 | mch_memmove(buf + offset, string, (size_t)new_slen); | |
277 | } | |
278 | ! return (len + extra + offset); | |
279 | } | |
280 | ||
281 | return 0; /* no match found */ | |
282 | --- 4988,4994 ---- | |
283 | (size_t)(buflen - offset)); | |
284 | mch_memmove(buf + offset, string, (size_t)new_slen); | |
285 | } | |
286 | ! return retval == 0 ? (len + extra + offset) : retval; | |
287 | } | |
288 | ||
289 | return 0; /* no match found */ | |
290 | *** ../vim-7.3.090/src/vim.h 2010-12-17 20:23:56.000000000 +0100 | |
291 | --- src/vim.h 2010-12-30 12:06:45.000000000 +0100 | |
292 | *************** | |
293 | *** 2211,2214 **** | |
294 | --- 2211,2218 ---- | |
295 | #define MSCR_LEFT -1 | |
296 | #define MSCR_RIGHT -2 | |
297 | ||
298 | + #define KEYLEN_PART_KEY -1 /* keylen value for incomplete key-code */ | |
299 | + #define KEYLEN_PART_MAP -2 /* keylen value for incomplete mapping */ | |
300 | + #define KEYLEN_REMOVED 9999 /* keylen value for removed sequence */ | |
301 | + | |
302 | #endif /* VIM__H */ | |
303 | *** ../vim-7.3.090/src/version.c 2010-12-30 11:41:05.000000000 +0100 | |
304 | --- src/version.c 2010-12-30 12:24:56.000000000 +0100 | |
305 | *************** | |
306 | *** 716,717 **** | |
307 | --- 716,719 ---- | |
308 | { /* Add new patch number below this line */ | |
309 | + /**/ | |
310 | + 91, | |
311 | /**/ | |
312 | ||
313 | -- | |
314 | hundred-and-one symptoms of being an internet addict: | |
315 | 56. You leave the modem speaker on after connecting because you think it | |
316 | sounds like the ocean wind...the perfect soundtrack for "surfing the net". | |
317 | ||
318 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
319 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
320 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
321 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |