summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.091
blob: f0aac0d9df8d3be0a00068d5d7d88be847495f07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
To: vim_dev@googlegroups.com
Subject: Patch 7.3.091
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.091
Problem:    "vim -w foo" writes special key codes for removed escape
	    sequences. (Josh Triplett)
Solution:   Don't write K_IGNORE codes.
Files:	    src/getchar.c, src/misc1.c, src/term.c, src/vim.h


*** ../vim-7.3.090/src/getchar.c	2010-10-27 17:39:00.000000000 +0200
--- src/getchar.c	2010-12-30 12:16:36.000000000 +0100
***************
*** 1506,1514 ****
      }
  }
  
- #define KL_PART_KEY -1		/* keylen value for incomplete key-code */
- #define KL_PART_MAP -2		/* keylen value for incomplete mapping */
- 
  /*
   * Get the next input character.
   * Can return a special key or a multi-byte character.
--- 1506,1511 ----
***************
*** 2171,2177 ****
  					if (!timedout)
  					{
  					    /* break at a partly match */
! 					    keylen = KL_PART_MAP;
  					    break;
  					}
  				    }
--- 2168,2174 ----
  					if (!timedout)
  					{
  					    /* break at a partly match */
! 					    keylen = KEYLEN_PART_MAP;
  					    break;
  					}
  				    }
***************
*** 2192,2198 ****
  
  			/* If no partly match found, use the longest full
  			 * match. */
! 			if (keylen != KL_PART_MAP)
  			{
  			    mp = mp_match;
  			    keylen = mp_match_len;
--- 2189,2195 ----
  
  			/* If no partly match found, use the longest full
  			 * match. */
! 			if (keylen != KEYLEN_PART_MAP)
  			{
  			    mp = mp_match;
  			    keylen = mp_match_len;
***************
*** 2230,2236 ****
  			}
  			/* Need more chars for partly match. */
  			if (mlen == typebuf.tb_len)
! 			    keylen = KL_PART_KEY;
  			else if (max_mlen < mlen)
  			    /* no match, may have to check for termcode at
  			     * next character */
--- 2227,2233 ----
  			}
  			/* Need more chars for partly match. */
  			if (mlen == typebuf.tb_len)
! 			    keylen = KEYLEN_PART_KEY;
  			else if (max_mlen < mlen)
  			    /* no match, may have to check for termcode at
  			     * next character */
***************
*** 2238,2244 ****
  		    }
  
  		    if ((mp == NULL || max_mlen >= mp_match_len)
! 						     && keylen != KL_PART_MAP)
  		    {
  			int	save_keylen = keylen;
  
--- 2235,2241 ----
  		    }
  
  		    if ((mp == NULL || max_mlen >= mp_match_len)
! 						 && keylen != KEYLEN_PART_MAP)
  		    {
  			int	save_keylen = keylen;
  
***************
*** 2264,2271 ****
  			    /* If no termcode matched but 'pastetoggle'
  			     * matched partially it's like an incomplete key
  			     * sequence. */
! 			    if (keylen == 0 && save_keylen == KL_PART_KEY)
! 				keylen = KL_PART_KEY;
  
  			    /*
  			     * When getting a partial match, but the last
--- 2261,2268 ----
  			    /* If no termcode matched but 'pastetoggle'
  			     * matched partially it's like an incomplete key
  			     * sequence. */
! 			    if (keylen == 0 && save_keylen == KEYLEN_PART_KEY)
! 				keylen = KEYLEN_PART_KEY;
  
  			    /*
  			     * When getting a partial match, but the last
***************
*** 2302,2308 ****
  				    continue;
  				}
  				if (*s == NUL)	    /* need more characters */
! 				    keylen = KL_PART_KEY;
  			    }
  			    if (keylen >= 0)
  #endif
--- 2299,2305 ----
  				    continue;
  				}
  				if (*s == NUL)	    /* need more characters */
! 				    keylen = KEYLEN_PART_KEY;
  			    }
  			    if (keylen >= 0)
  #endif
***************
*** 2339,2345 ****
  			if (keylen > 0)	    /* full matching terminal code */
  			{
  #if defined(FEAT_GUI) && defined(FEAT_MENU)
! 			    if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
  					 && typebuf.tb_buf[typebuf.tb_off + 1]
  								   == KS_MENU)
  			    {
--- 2336,2343 ----
  			if (keylen > 0)	    /* full matching terminal code */
  			{
  #if defined(FEAT_GUI) && defined(FEAT_MENU)
! 			    if (typebuf.tb_len >= 2
! 				&& typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
  					 && typebuf.tb_buf[typebuf.tb_off + 1]
  								   == KS_MENU)
  			    {
***************
*** 2381,2387 ****
  			/* Partial match: get some more characters.  When a
  			 * matching mapping was found use that one. */
  			if (mp == NULL || keylen < 0)
! 			    keylen = KL_PART_KEY;
  			else
  			    keylen = mp_match_len;
  		    }
--- 2379,2385 ----
  			/* Partial match: get some more characters.  When a
  			 * matching mapping was found use that one. */
  			if (mp == NULL || keylen < 0)
! 			    keylen = KEYLEN_PART_KEY;
  			else
  			    keylen = mp_match_len;
  		    }
***************
*** 2553,2559 ****
  #endif
  			&& typebuf.tb_maplen == 0
  			&& (State & INSERT)
! 			&& (p_timeout || (keylen == KL_PART_KEY && p_ttimeout))
  			&& (c = inchar(typebuf.tb_buf + typebuf.tb_off
  						     + typebuf.tb_len, 3, 25L,
  						 typebuf.tb_change_cnt)) == 0)
--- 2551,2558 ----
  #endif
  			&& typebuf.tb_maplen == 0
  			&& (State & INSERT)
! 			&& (p_timeout
! 			    || (keylen == KEYLEN_PART_KEY && p_ttimeout))
  			&& (c = inchar(typebuf.tb_buf + typebuf.tb_off
  						     + typebuf.tb_len, 3, 25L,
  						 typebuf.tb_change_cnt)) == 0)
***************
*** 2783,2791 ****
  			    ? 0
  			    : ((typebuf.tb_len == 0
  				    || !(p_timeout || (p_ttimeout
! 						   && keylen == KL_PART_KEY)))
  				    ? -1L
! 				    : ((keylen == KL_PART_KEY && p_ttm >= 0)
  					    ? p_ttm
  					    : p_tm)), typebuf.tb_change_cnt);
  
--- 2782,2790 ----
  			    ? 0
  			    : ((typebuf.tb_len == 0
  				    || !(p_timeout || (p_ttimeout
! 					       && keylen == KEYLEN_PART_KEY)))
  				    ? -1L
! 				    : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
  					    ? p_ttm
  					    : p_tm)), typebuf.tb_change_cnt);
  
*** ../vim-7.3.090/src/misc1.c	2010-12-02 16:01:23.000000000 +0100
--- src/misc1.c	2010-12-30 12:28:59.000000000 +0100
***************
*** 3114,3123 ****
  	       && (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm)))
  	    continue;
  
! 	/* found a termcode: adjust length */
! 	if (n > 0)
  	    len = n;
! 	if (len == 0)	    /* nothing typed yet */
  	    continue;
  
  	/* Handle modifier and/or special key code. */
--- 3114,3124 ----
  	       && (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm)))
  	    continue;
  
! 	if (n == KEYLEN_REMOVED)  /* key code removed */
! 	    continue;
! 	if (n > 0)		/* found a termcode: adjust length */
  	    len = n;
! 	if (len == 0)		/* nothing typed yet */
  	    continue;
  
  	/* Handle modifier and/or special key code. */
*** ../vim-7.3.090/src/term.c	2010-08-15 21:57:32.000000000 +0200
--- src/term.c	2010-12-30 12:14:48.000000000 +0100
***************
*** 3828,3833 ****
--- 3831,3837 ----
   * Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off
   * + max_offset].
   * Return 0 for no match, -1 for partial match, > 0 for full match.
+  * Return KEYLEN_REMOVED when a key code was deleted.
   * With a match, the match is removed, the replacement code is inserted in
   * typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is
   * returned.
***************
*** 3845,3850 ****
--- 3849,3855 ----
      int		slen = 0;	/* init for GCC */
      int		modslen;
      int		len;
+     int		retval = 0;
      int		offset;
      char_u	key_name[2];
      int		modifiers;
***************
*** 4940,4945 ****
--- 4945,4957 ----
  #endif
  		string[new_slen++] = key_name[1];
  	}
+ 	else if (new_slen == 0 && key_name[0] == KS_EXTRA
+ 						  && key_name[1] == KE_IGNORE)
+ 	{
+ 	    /* Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED
+ 	     * to indicate what happened. */
+ 	    retval = KEYLEN_REMOVED;
+ 	}
  	else
  	{
  	    string[new_slen++] = K_SPECIAL;
***************
*** 4976,4982 ****
  						   (size_t)(buflen - offset));
  	    mch_memmove(buf + offset, string, (size_t)new_slen);
  	}
! 	return (len + extra + offset);
      }
  
      return 0;			    /* no match found */
--- 4988,4994 ----
  						   (size_t)(buflen - offset));
  	    mch_memmove(buf + offset, string, (size_t)new_slen);
  	}
! 	return retval == 0 ? (len + extra + offset) : retval;
      }
  
      return 0;			    /* no match found */
*** ../vim-7.3.090/src/vim.h	2010-12-17 20:23:56.000000000 +0100
--- src/vim.h	2010-12-30 12:06:45.000000000 +0100
***************
*** 2211,2214 ****
--- 2211,2218 ----
  #define MSCR_LEFT	-1
  #define MSCR_RIGHT	-2
  
+ #define KEYLEN_PART_KEY -1	/* keylen value for incomplete key-code */
+ #define KEYLEN_PART_MAP -2	/* keylen value for incomplete mapping */
+ #define KEYLEN_REMOVED  9999	/* keylen value for removed sequence */
+ 
  #endif /* VIM__H */
*** ../vim-7.3.090/src/version.c	2010-12-30 11:41:05.000000000 +0100
--- src/version.c	2010-12-30 12:24:56.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     91,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
56. You leave the modem speaker on after connecting because you think it
    sounds like the ocean wind...the perfect soundtrack for "surfing the net".

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///