]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.036
- updated to 7.1.285
[packages/vim.git] / 7.1.036
1 To: vim-dev@vim.org
2 Subject: patch 7.1.036
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 7.1.036
11 Problem:    Completing ":echohl" argument should include "None". (Ori
12             Avtalion)  ":match" should have "none" too.
13 Solution:   Add flags to use expand_highlight().  Also fix that when disabling
14             FEAT_CMDL_COMPL compilation fails.  (Chris Lubinski)
15 Files:      src/eval.c, src/ex_docmd.c, src/ex_getln.c, src/proto/syntax.pro
16             src/syntax.c
17
18
19 *** ../vim-7.1.035/src/eval.c   Tue Jul 24 10:44:10 2007
20 --- src/eval.c  Wed Jul 11 19:50:27 2007
21 ***************
22 *** 1411,1417 ****
23   }
24   
25   
26 ! #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO)
27   /*
28    * Call some vimL function and return the result in "*rettv".
29    * Uses argv[argc] for the function arguments.
30 --- 1411,1418 ----
31   }
32   
33   
34 ! #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) \
35 !       || defined(FEAT_COMPL_FUNC) || defined(PROTO)
36   /*
37    * Call some vimL function and return the result in "*rettv".
38    * Uses argv[argc] for the function arguments.
39 ***************
40 *** 1484,1489 ****
41 --- 1485,1491 ----
42       return ret;
43   }
44   
45 + # if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO)
46   /*
47    * Call vimL function "func" and return the result as a string.
48    * Returns NULL when calling the function fails.
49 ***************
50 *** 1506,1513 ****
51       clear_tv(&rettv);
52       return retval;
53   }
54   
55 ! #if defined(FEAT_COMPL_FUNC) || defined(PROTO)
56   /*
57    * Call vimL function "func" and return the result as a number.
58    * Returns -1 when calling the function fails.
59 --- 1508,1516 ----
60       clear_tv(&rettv);
61       return retval;
62   }
63 + # endif
64   
65 ! # if defined(FEAT_COMPL_FUNC) || defined(PROTO)
66   /*
67    * Call vimL function "func" and return the result as a number.
68    * Returns -1 when calling the function fails.
69 ***************
70 *** 1530,1536 ****
71       clear_tv(&rettv);
72       return retval;
73   }
74 ! #endif
75   
76   /*
77    * Call vimL function "func" and return the result as a list
78 --- 1533,1539 ----
79       clear_tv(&rettv);
80       return retval;
81   }
82 ! # endif
83   
84   /*
85    * Call vimL function "func" and return the result as a list
86 ***************
87 *** 1556,1563 ****
88   
89       return rettv.vval.v_list;
90   }
91
92   #endif
93   
94   /*
95    * Save the current function call pointer, and set it to NULL.
96 --- 1559,1566 ----
97   
98       return rettv.vval.v_list;
99   }
100   #endif
101
102   
103   /*
104    * Save the current function call pointer, and set it to NULL.
105 *** ../vim-7.1.035/src/ex_docmd.c       Mon Jul 16 20:38:56 2007
106 --- src/ex_docmd.c      Sun Jul 15 17:20:09 2007
107 ***************
108 *** 3406,3419 ****
109         case CMD_windo:
110             return arg;
111   
112 ! #ifdef FEAT_SEARCH_EXTRA
113         case CMD_match:
114             if (*arg == NUL || !ends_excmd(*arg))
115             {
116 !               /* Dummy call to clear variables. */
117 !               set_context_in_highlight_cmd(xp, (char_u *)"link n");
118 !               xp->xp_context = EXPAND_HIGHLIGHT;
119 !               xp->xp_pattern = arg;
120                 arg = skipwhite(skiptowhite(arg));
121                 if (*arg != NUL)
122                 {
123 --- 3406,3418 ----
124         case CMD_windo:
125             return arg;
126   
127 ! #ifdef FEAT_CMDL_COMPL
128 ! # ifdef FEAT_SEARCH_EXTRA
129         case CMD_match:
130             if (*arg == NUL || !ends_excmd(*arg))
131             {
132 !               /* also complete "None" */
133 !               set_context_in_echohl_cmd(xp, arg);
134                 arg = skipwhite(skiptowhite(arg));
135                 if (*arg != NUL)
136                 {
137 ***************
138 *** 3422,3430 ****
139                 }
140             }
141             return find_nextcmd(arg);
142 ! #endif
143   
144 - #ifdef FEAT_CMDL_COMPL
145   /*
146    * All completion for the +cmdline_compl feature goes here.
147    */
148 --- 3421,3428 ----
149                 }
150             }
151             return find_nextcmd(arg);
152 ! # endif
153   
154   /*
155    * All completion for the +cmdline_compl feature goes here.
156    */
157 ***************
158 *** 3622,3629 ****
159             break;
160   
161         case CMD_echohl:
162 !           xp->xp_context = EXPAND_HIGHLIGHT;
163 !           xp->xp_pattern = arg;
164             break;
165   #endif
166         case CMD_highlight:
167 --- 3620,3626 ----
168             break;
169   
170         case CMD_echohl:
171 !           set_context_in_echohl_cmd(xp, arg);
172             break;
173   #endif
174         case CMD_highlight:
175 *** ../vim-7.1.035/src/ex_getln.c       Tue Jul 17 18:14:14 2007
176 --- src/ex_getln.c      Tue Jul 17 18:05:49 2007
177 ***************
178 *** 268,274 ****
179 --- 268,276 ----
180       {
181         xpc.xp_context = ccline.xp_context;
182         xpc.xp_pattern = ccline.cmdbuff;
183 + # if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)
184         xpc.xp_arg = ccline.xp_arg;
185 + # endif
186       }
187   #endif
188   
189 ***************
190 *** 4151,4163 ****
191 --- 4153,4171 ----
192   
193   #ifdef FEAT_EVAL
194       if (ccline.cmdfirstc == '=')
195 +     {
196 + # ifdef FEAT_CMDL_COMPL
197         /* pass CMD_SIZE because there is no real command */
198         set_context_for_expression(xp, str, CMD_SIZE);
199 + # endif
200 +     }
201       else if (ccline.input_fn)
202       {
203         xp->xp_context = ccline.xp_context;
204         xp->xp_pattern = ccline.cmdbuff;
205 + # if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)
206         xp->xp_arg = ccline.xp_arg;
207 + # endif
208       }
209       else
210   #endif
211 ***************
212 *** 4504,4509 ****
213 --- 4512,4523 ----
214       /* Sort the results.  Keep menu's in the specified order. */
215       if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS)
216         sort_strings(*file, *num_file);
217
218 + #ifdef FEAT_CMDL_COMPL
219 +     /* Reset the variables used for special highlight names expansion, so that
220 +      * they don't show up when getting normal highlight names by ID. */
221 +     reset_expand_highlight();
222 + #endif
223   
224       return OK;
225   }
226 *** ../vim-7.1.035/src/proto/syntax.pro Sat May  5 19:23:52 2007
227 --- src/proto/syntax.pro        Fri Jul 13 19:51:43 2007
228 ***************
229 *** 8,13 ****
230 --- 8,15 ----
231   void syntax_clear __ARGS((buf_T *buf));
232   void ex_syntax __ARGS((exarg_T *eap));
233   int syntax_present __ARGS((buf_T *buf));
234 + void reset_expand_highlight __ARGS((void));
235 + void set_context_in_echohl_cmd __ARGS((expand_T *xp, char_u *arg));
236   void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg));
237   char_u *get_syntax_name __ARGS((expand_T *xp, int idx));
238   int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp));
239 *** ../vim-7.1.035/src/syntax.c Thu Jun 28 11:59:13 2007
240 --- src/syntax.c        Fri Jul 13 19:51:39 2007
241 ***************
242 *** 66,73 ****
243   #define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data)))
244   
245   #ifdef FEAT_CMDL_COMPL
246 ! static int include_default = FALSE;   /* include "default" for expansion */
247 ! static int include_link = FALSE;      /* include "link" for expansion */
248   #endif
249   
250   /*
251 --- 66,75 ----
252   #define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data)))
253   
254   #ifdef FEAT_CMDL_COMPL
255 ! /* Flags to indicate an additional string for highlight name completion. */
256 ! static int include_none = 0;  /* when 1 include "None" */
257 ! static int include_default = 0;       /* when 1 include "default" */
258 ! static int include_link = 0;  /* when 2 include "link" and "clear" */
259   #endif
260   
261   /*
262 ***************
263 *** 5968,5973 ****
264 --- 5970,5998 ----
265       EXP_CASE      /* expand ":syn case" arguments */
266   } expand_what;
267   
268 + /*
269 +  * Reset include_link, include_default, include_none to 0.
270 +  * Called when we are done expanding.
271 +  */
272 +     void
273 + reset_expand_highlight()
274 + {
275 +     include_link = include_default = include_none = 0;
276 + }
277
278 + /*
279 +  * Handle command line completion for :match and :echohl command: Add "None"
280 +  * as highlight group.
281 +  */
282 +     void
283 + set_context_in_echohl_cmd(xp, arg)
284 +     expand_T  *xp;
285 +     char_u    *arg;
286 + {
287 +     xp->xp_context = EXPAND_HIGHLIGHT;
288 +     xp->xp_pattern = arg;
289 +     include_none = 1;
290 + }
291   
292   /*
293    * Handle command line completion for :syntax command.
294 ***************
295 *** 5983,5990 ****
296       xp->xp_context = EXPAND_SYNTAX;
297       expand_what = EXP_SUBCMD;
298       xp->xp_pattern = arg;
299 !     include_link = FALSE;
300 !     include_default = FALSE;
301   
302       /* (part of) subcommand already typed */
303       if (*arg != NUL)
304 --- 6008,6015 ----
305       xp->xp_context = EXPAND_SYNTAX;
306       expand_what = EXP_SUBCMD;
307       xp->xp_pattern = arg;
308 !     include_link = 0;
309 !     include_default = 0;
310   
311       /* (part of) subcommand already typed */
312       if (*arg != NUL)
313 ***************
314 *** 8949,8955 ****
315       return OK;
316   }
317   
318 ! #ifdef FEAT_CMDL_COMPL
319   
320   static void highlight_list __ARGS((void));
321   static void highlight_list_two __ARGS((int cnt, int attr));
322 --- 8974,8980 ----
323       return OK;
324   }
325   
326 ! #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
327   
328   static void highlight_list __ARGS((void));
329   static void highlight_list_two __ARGS((int cnt, int attr));
330 ***************
331 *** 8967,8974 ****
332       /* Default: expand group names */
333       xp->xp_context = EXPAND_HIGHLIGHT;
334       xp->xp_pattern = arg;
335 !     include_link = TRUE;
336 !     include_default = TRUE;
337   
338       /* (part of) subcommand already typed */
339       if (*arg != NUL)
340 --- 8992,8999 ----
341       /* Default: expand group names */
342       xp->xp_context = EXPAND_HIGHLIGHT;
343       xp->xp_pattern = arg;
344 !     include_link = 2;
345 !     include_default = 1;
346   
347       /* (part of) subcommand already typed */
348       if (*arg != NUL)
349 ***************
350 *** 8976,8982 ****
351         p = skiptowhite(arg);
352         if (*p != NUL)                  /* past "default" or group name */
353         {
354 !           include_default = FALSE;
355             if (STRNCMP("default", arg, p - arg) == 0)
356             {
357                 arg = skipwhite(p);
358 --- 9001,9007 ----
359         p = skiptowhite(arg);
360         if (*p != NUL)                  /* past "default" or group name */
361         {
362 !           include_default = 0;
363             if (STRNCMP("default", arg, p - arg) == 0)
364             {
365                 arg = skipwhite(p);
366 ***************
367 *** 8985,8991 ****
368             }
369             if (*p != NUL)                      /* past group name */
370             {
371 !               include_link = FALSE;
372                 if (arg[1] == 'i' && arg[0] == 'N')
373                     highlight_list();
374                 if (STRNCMP("link", arg, p - arg) == 0
375 --- 9010,9016 ----
376             }
377             if (*p != NUL)                      /* past group name */
378             {
379 !               include_link = 0;
380                 if (arg[1] == 'i' && arg[0] == 'N')
381                     highlight_list();
382                 if (STRNCMP("link", arg, p - arg) == 0
383 ***************
384 *** 9045,9075 ****
385       expand_T  *xp;
386       int               idx;
387   {
388 -     if (idx == highlight_ga.ga_len
389   #ifdef FEAT_CMDL_COMPL
390 !           && include_link
391 ! #endif
392 !           )
393         return (char_u *)"link";
394 !     if (idx == highlight_ga.ga_len + 1
395 ! #ifdef FEAT_CMDL_COMPL
396 !           && include_link
397 ! #endif
398 !           )
399         return (char_u *)"clear";
400 -     if (idx == highlight_ga.ga_len + 2
401 - #ifdef FEAT_CMDL_COMPL
402 -           && include_default
403   #endif
404 -           )
405 -       return (char_u *)"default";
406       if (idx < 0 || idx >= highlight_ga.ga_len)
407         return NULL;
408       return HL_TABLE()[idx].sg_name;
409   }
410   #endif
411   
412 ! #ifdef FEAT_GUI
413   /*
414    * Free all the highlight group fonts.
415    * Used when quitting for systems which need it.
416 --- 9070,9094 ----
417       expand_T  *xp;
418       int               idx;
419   {
420   #ifdef FEAT_CMDL_COMPL
421 !     if (idx == highlight_ga.ga_len && include_none != 0)
422 !       return (char_u *)"none";
423 !     if (idx == highlight_ga.ga_len + include_none && include_default != 0)
424 !       return (char_u *)"default";
425 !     if (idx == highlight_ga.ga_len + include_none + include_default
426 !                                                        && include_link != 0)
427         return (char_u *)"link";
428 !     if (idx == highlight_ga.ga_len + include_none + include_default + 1
429 !                                                        && include_link != 0)
430         return (char_u *)"clear";
431   #endif
432       if (idx < 0 || idx >= highlight_ga.ga_len)
433         return NULL;
434       return HL_TABLE()[idx].sg_name;
435   }
436   #endif
437   
438 ! #if defined(FEAT_GUI) || defined(PROTO)
439   /*
440    * Free all the highlight group fonts.
441    * Used when quitting for systems which need it.
442 *** ../vim-7.1.035/src/version.c        Tue Jul 24 11:15:46 2007
443 --- src/version.c       Tue Jul 24 14:30:18 2007
444 ***************
445 *** 668,669 ****
446 --- 668,671 ----
447   {   /* Add new patch number below this line */
448 + /**/
449 +     36,
450   /**/
451
452 -- 
453 Apparently, 1 in 5 people in the world are Chinese.  And there are 5
454 people in my family, so it must be one of them.  It's either my mum
455 or my dad.  Or my older brother Colin.  Or my younger brother
456 Ho-Cha-Chu.  But I think it's Colin.
457
458  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
459 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
460 \\\        download, build and distribute -- http://www.A-A-P.org        ///
461  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.058657 seconds and 3 git commands to generate.