4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
26 ! #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO)
28 * Call some vimL function and return the result in "*rettv".
29 * Uses argv[argc] for the function arguments.
34 ! #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) \
35 ! || defined(FEAT_COMPL_FUNC) || defined(PROTO)
37 * Call some vimL function and return the result in "*rettv".
38 * Uses argv[argc] for the function arguments.
45 + # if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO)
47 * Call vimL function "func" and return the result as a string.
48 * Returns NULL when calling the function fails.
55 ! #if defined(FEAT_COMPL_FUNC) || defined(PROTO)
57 * Call vimL function "func" and return the result as a number.
58 * Returns -1 when calling the function fails.
65 ! # if defined(FEAT_COMPL_FUNC) || defined(PROTO)
67 * Call vimL function "func" and return the result as a number.
68 * Returns -1 when calling the function fails.
77 * Call vimL function "func" and return the result as a list
85 * Call vimL function "func" and return the result as a list
89 return rettv.vval.v_list;
95 * Save the current function call pointer, and set it to NULL.
98 return rettv.vval.v_list;
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
112 ! #ifdef FEAT_SEARCH_EXTRA
114 if (*arg == NUL || !ends_excmd(*arg))
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));
127 ! #ifdef FEAT_CMDL_COMPL
128 ! # ifdef FEAT_SEARCH_EXTRA
130 if (*arg == NUL || !ends_excmd(*arg))
132 ! /* also complete "None" */
133 ! set_context_in_echohl_cmd(xp, arg);
134 arg = skipwhite(skiptowhite(arg));
141 return find_nextcmd(arg);
144 - #ifdef FEAT_CMDL_COMPL
146 * All completion for the +cmdline_compl feature goes here.
151 return find_nextcmd(arg);
155 * All completion for the +cmdline_compl feature goes here.
162 ! xp->xp_context = EXPAND_HIGHLIGHT;
163 ! xp->xp_pattern = arg;
171 ! set_context_in_echohl_cmd(xp, arg);
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
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;
194 if (ccline.cmdfirstc == '=')
196 + # ifdef FEAT_CMDL_COMPL
197 /* pass CMD_SIZE because there is no real command */
198 set_context_for_expression(xp, str, CMD_SIZE);
201 else if (ccline.input_fn)
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;
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);
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();
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
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
243 #define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data)))
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 */
252 #define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data)))
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" */
265 EXP_CASE /* expand ":syn case" arguments */
269 + * Reset include_link, include_default, include_none to 0.
270 + * Called when we are done expanding.
273 + reset_expand_highlight()
275 + include_link = include_default = include_none = 0;
279 + * Handle command line completion for :match and :echohl command: Add "None"
280 + * as highlight group.
283 + set_context_in_echohl_cmd(xp, arg)
287 + xp->xp_context = EXPAND_HIGHLIGHT;
288 + xp->xp_pattern = arg;
293 * Handle command line completion for :syntax command.
296 xp->xp_context = EXPAND_SYNTAX;
297 expand_what = EXP_SUBCMD;
298 xp->xp_pattern = arg;
299 ! include_link = FALSE;
300 ! include_default = FALSE;
302 /* (part of) subcommand already typed */
305 xp->xp_context = EXPAND_SYNTAX;
306 expand_what = EXP_SUBCMD;
307 xp->xp_pattern = arg;
309 ! include_default = 0;
311 /* (part of) subcommand already typed */
318 ! #ifdef FEAT_CMDL_COMPL
320 static void highlight_list __ARGS((void));
321 static void highlight_list_two __ARGS((int cnt, int attr));
326 ! #if defined(FEAT_CMDL_COMPL) || defined(PROTO)
328 static void highlight_list __ARGS((void));
329 static void highlight_list_two __ARGS((int cnt, int attr));
332 /* Default: expand group names */
333 xp->xp_context = EXPAND_HIGHLIGHT;
334 xp->xp_pattern = arg;
335 ! include_link = TRUE;
336 ! include_default = TRUE;
338 /* (part of) subcommand already typed */
341 /* Default: expand group names */
342 xp->xp_context = EXPAND_HIGHLIGHT;
343 xp->xp_pattern = arg;
345 ! include_default = 1;
347 /* (part of) subcommand already typed */
351 p = skiptowhite(arg);
352 if (*p != NUL) /* past "default" or group name */
354 ! include_default = FALSE;
355 if (STRNCMP("default", arg, p - arg) == 0)
359 p = skiptowhite(arg);
360 if (*p != NUL) /* past "default" or group name */
362 ! include_default = 0;
363 if (STRNCMP("default", arg, p - arg) == 0)
369 if (*p != NUL) /* past group name */
371 ! include_link = FALSE;
372 if (arg[1] == 'i' && arg[0] == 'N')
374 if (STRNCMP("link", arg, p - arg) == 0
377 if (*p != NUL) /* past group name */
380 if (arg[1] == 'i' && arg[0] == 'N')
382 if (STRNCMP("link", arg, p - arg) == 0
388 - if (idx == highlight_ga.ga_len
389 #ifdef FEAT_CMDL_COMPL
393 return (char_u *)"link";
394 ! if (idx == highlight_ga.ga_len + 1
395 ! #ifdef FEAT_CMDL_COMPL
399 return (char_u *)"clear";
400 - if (idx == highlight_ga.ga_len + 2
401 - #ifdef FEAT_CMDL_COMPL
405 - return (char_u *)"default";
406 if (idx < 0 || idx >= highlight_ga.ga_len)
408 return HL_TABLE()[idx].sg_name;
414 * Free all the highlight group fonts.
415 * Used when quitting for systems which need it.
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";
432 if (idx < 0 || idx >= highlight_ga.ga_len)
434 return HL_TABLE()[idx].sg_name;
438 ! #if defined(FEAT_GUI) || defined(PROTO)
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
447 { /* Add new patch number below this line */
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.
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 ///