forked from aniani/vim
updated for version 7.1-036
This commit is contained in:
11
src/eval.c
11
src/eval.c
@@ -1411,7 +1411,8 @@ eval_expr(arg, nextcmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO)
|
#if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) \
|
||||||
|
|| defined(FEAT_COMPL_FUNC) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Call some vimL function and return the result in "*rettv".
|
* Call some vimL function and return the result in "*rettv".
|
||||||
* Uses argv[argc] for the function arguments.
|
* Uses argv[argc] for the function arguments.
|
||||||
@@ -1484,6 +1485,7 @@ call_vim_function(func, argc, argv, safe, rettv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Call vimL function "func" and return the result as a string.
|
* Call vimL function "func" and return the result as a string.
|
||||||
* Returns NULL when calling the function fails.
|
* Returns NULL when calling the function fails.
|
||||||
@@ -1506,8 +1508,9 @@ call_func_retstr(func, argc, argv, safe)
|
|||||||
clear_tv(&rettv);
|
clear_tv(&rettv);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
#if defined(FEAT_COMPL_FUNC) || defined(PROTO)
|
# if defined(FEAT_COMPL_FUNC) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Call vimL function "func" and return the result as a number.
|
* Call vimL function "func" and return the result as a number.
|
||||||
* Returns -1 when calling the function fails.
|
* Returns -1 when calling the function fails.
|
||||||
@@ -1530,7 +1533,7 @@ call_func_retnr(func, argc, argv, safe)
|
|||||||
clear_tv(&rettv);
|
clear_tv(&rettv);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call vimL function "func" and return the result as a list
|
* Call vimL function "func" and return the result as a list
|
||||||
@@ -1556,9 +1559,9 @@ call_func_retlist(func, argc, argv, safe)
|
|||||||
|
|
||||||
return rettv.vval.v_list;
|
return rettv.vval.v_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save the current function call pointer, and set it to NULL.
|
* Save the current function call pointer, and set it to NULL.
|
||||||
* Used when executing autocommands and for ":source".
|
* Used when executing autocommands and for ":source".
|
||||||
|
@@ -3406,14 +3406,13 @@ set_one_cmd_context(xp, buff)
|
|||||||
case CMD_windo:
|
case CMD_windo:
|
||||||
return arg;
|
return arg;
|
||||||
|
|
||||||
#ifdef FEAT_SEARCH_EXTRA
|
#ifdef FEAT_CMDL_COMPL
|
||||||
|
# ifdef FEAT_SEARCH_EXTRA
|
||||||
case CMD_match:
|
case CMD_match:
|
||||||
if (*arg == NUL || !ends_excmd(*arg))
|
if (*arg == NUL || !ends_excmd(*arg))
|
||||||
{
|
{
|
||||||
/* Dummy call to clear variables. */
|
/* also complete "None" */
|
||||||
set_context_in_highlight_cmd(xp, (char_u *)"link n");
|
set_context_in_echohl_cmd(xp, arg);
|
||||||
xp->xp_context = EXPAND_HIGHLIGHT;
|
|
||||||
xp->xp_pattern = arg;
|
|
||||||
arg = skipwhite(skiptowhite(arg));
|
arg = skipwhite(skiptowhite(arg));
|
||||||
if (*arg != NUL)
|
if (*arg != NUL)
|
||||||
{
|
{
|
||||||
@@ -3422,9 +3421,8 @@ set_one_cmd_context(xp, buff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return find_nextcmd(arg);
|
return find_nextcmd(arg);
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#ifdef FEAT_CMDL_COMPL
|
|
||||||
/*
|
/*
|
||||||
* All completion for the +cmdline_compl feature goes here.
|
* All completion for the +cmdline_compl feature goes here.
|
||||||
*/
|
*/
|
||||||
@@ -3622,8 +3620,7 @@ set_one_cmd_context(xp, buff)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_echohl:
|
case CMD_echohl:
|
||||||
xp->xp_context = EXPAND_HIGHLIGHT;
|
set_context_in_echohl_cmd(xp, arg);
|
||||||
xp->xp_pattern = arg;
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case CMD_highlight:
|
case CMD_highlight:
|
||||||
|
@@ -268,7 +268,9 @@ getcmdline(firstc, count, indent)
|
|||||||
{
|
{
|
||||||
xpc.xp_context = ccline.xp_context;
|
xpc.xp_context = ccline.xp_context;
|
||||||
xpc.xp_pattern = ccline.cmdbuff;
|
xpc.xp_pattern = ccline.cmdbuff;
|
||||||
|
# if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)
|
||||||
xpc.xp_arg = ccline.xp_arg;
|
xpc.xp_arg = ccline.xp_arg;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -4151,13 +4153,19 @@ set_cmd_context(xp, str, len, col)
|
|||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (ccline.cmdfirstc == '=')
|
if (ccline.cmdfirstc == '=')
|
||||||
|
{
|
||||||
|
# ifdef FEAT_CMDL_COMPL
|
||||||
/* pass CMD_SIZE because there is no real command */
|
/* pass CMD_SIZE because there is no real command */
|
||||||
set_context_for_expression(xp, str, CMD_SIZE);
|
set_context_for_expression(xp, str, CMD_SIZE);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
else if (ccline.input_fn)
|
else if (ccline.input_fn)
|
||||||
{
|
{
|
||||||
xp->xp_context = ccline.xp_context;
|
xp->xp_context = ccline.xp_context;
|
||||||
xp->xp_pattern = ccline.cmdbuff;
|
xp->xp_pattern = ccline.cmdbuff;
|
||||||
|
# if defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)
|
||||||
xp->xp_arg = ccline.xp_arg;
|
xp->xp_arg = ccline.xp_arg;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -4505,6 +4513,12 @@ ExpandGeneric(xp, regmatch, num_file, file, func)
|
|||||||
if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS)
|
if (xp->xp_context != EXPAND_MENUNAMES && xp->xp_context != EXPAND_MENUS)
|
||||||
sort_strings(*file, *num_file);
|
sort_strings(*file, *num_file);
|
||||||
|
|
||||||
|
#ifdef FEAT_CMDL_COMPL
|
||||||
|
/* Reset the variables used for special highlight names expansion, so that
|
||||||
|
* they don't show up when getting normal highlight names by ID. */
|
||||||
|
reset_expand_highlight();
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,6 +8,8 @@ int get_syntax_attr __ARGS((colnr_T col, int *can_spell));
|
|||||||
void syntax_clear __ARGS((buf_T *buf));
|
void syntax_clear __ARGS((buf_T *buf));
|
||||||
void ex_syntax __ARGS((exarg_T *eap));
|
void ex_syntax __ARGS((exarg_T *eap));
|
||||||
int syntax_present __ARGS((buf_T *buf));
|
int syntax_present __ARGS((buf_T *buf));
|
||||||
|
void reset_expand_highlight __ARGS((void));
|
||||||
|
void set_context_in_echohl_cmd __ARGS((expand_T *xp, char_u *arg));
|
||||||
void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg));
|
void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg));
|
||||||
char_u *get_syntax_name __ARGS((expand_T *xp, int idx));
|
char_u *get_syntax_name __ARGS((expand_T *xp, int idx));
|
||||||
int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp));
|
int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp));
|
||||||
|
71
src/syntax.c
71
src/syntax.c
@@ -66,8 +66,10 @@ static garray_T highlight_ga; /* highlight groups for 'highlight' option */
|
|||||||
#define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data)))
|
#define HL_TABLE() ((struct hl_group *)((highlight_ga.ga_data)))
|
||||||
|
|
||||||
#ifdef FEAT_CMDL_COMPL
|
#ifdef FEAT_CMDL_COMPL
|
||||||
static int include_default = FALSE; /* include "default" for expansion */
|
/* Flags to indicate an additional string for highlight name completion. */
|
||||||
static int include_link = FALSE; /* include "link" for expansion */
|
static int include_none = 0; /* when 1 include "None" */
|
||||||
|
static int include_default = 0; /* when 1 include "default" */
|
||||||
|
static int include_link = 0; /* when 2 include "link" and "clear" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5968,6 +5970,29 @@ static enum
|
|||||||
EXP_CASE /* expand ":syn case" arguments */
|
EXP_CASE /* expand ":syn case" arguments */
|
||||||
} expand_what;
|
} expand_what;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset include_link, include_default, include_none to 0.
|
||||||
|
* Called when we are done expanding.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
reset_expand_highlight()
|
||||||
|
{
|
||||||
|
include_link = include_default = include_none = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handle command line completion for :match and :echohl command: Add "None"
|
||||||
|
* as highlight group.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
set_context_in_echohl_cmd(xp, arg)
|
||||||
|
expand_T *xp;
|
||||||
|
char_u *arg;
|
||||||
|
{
|
||||||
|
xp->xp_context = EXPAND_HIGHLIGHT;
|
||||||
|
xp->xp_pattern = arg;
|
||||||
|
include_none = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle command line completion for :syntax command.
|
* Handle command line completion for :syntax command.
|
||||||
@@ -5983,8 +6008,8 @@ set_context_in_syntax_cmd(xp, arg)
|
|||||||
xp->xp_context = EXPAND_SYNTAX;
|
xp->xp_context = EXPAND_SYNTAX;
|
||||||
expand_what = EXP_SUBCMD;
|
expand_what = EXP_SUBCMD;
|
||||||
xp->xp_pattern = arg;
|
xp->xp_pattern = arg;
|
||||||
include_link = FALSE;
|
include_link = 0;
|
||||||
include_default = FALSE;
|
include_default = 0;
|
||||||
|
|
||||||
/* (part of) subcommand already typed */
|
/* (part of) subcommand already typed */
|
||||||
if (*arg != NUL)
|
if (*arg != NUL)
|
||||||
@@ -8949,7 +8974,7 @@ highlight_changed()
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_CMDL_COMPL
|
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
||||||
|
|
||||||
static void highlight_list __ARGS((void));
|
static void highlight_list __ARGS((void));
|
||||||
static void highlight_list_two __ARGS((int cnt, int attr));
|
static void highlight_list_two __ARGS((int cnt, int attr));
|
||||||
@@ -8967,8 +8992,8 @@ set_context_in_highlight_cmd(xp, arg)
|
|||||||
/* Default: expand group names */
|
/* Default: expand group names */
|
||||||
xp->xp_context = EXPAND_HIGHLIGHT;
|
xp->xp_context = EXPAND_HIGHLIGHT;
|
||||||
xp->xp_pattern = arg;
|
xp->xp_pattern = arg;
|
||||||
include_link = TRUE;
|
include_link = 2;
|
||||||
include_default = TRUE;
|
include_default = 1;
|
||||||
|
|
||||||
/* (part of) subcommand already typed */
|
/* (part of) subcommand already typed */
|
||||||
if (*arg != NUL)
|
if (*arg != NUL)
|
||||||
@@ -8976,7 +9001,7 @@ set_context_in_highlight_cmd(xp, arg)
|
|||||||
p = skiptowhite(arg);
|
p = skiptowhite(arg);
|
||||||
if (*p != NUL) /* past "default" or group name */
|
if (*p != NUL) /* past "default" or group name */
|
||||||
{
|
{
|
||||||
include_default = FALSE;
|
include_default = 0;
|
||||||
if (STRNCMP("default", arg, p - arg) == 0)
|
if (STRNCMP("default", arg, p - arg) == 0)
|
||||||
{
|
{
|
||||||
arg = skipwhite(p);
|
arg = skipwhite(p);
|
||||||
@@ -8985,7 +9010,7 @@ set_context_in_highlight_cmd(xp, arg)
|
|||||||
}
|
}
|
||||||
if (*p != NUL) /* past group name */
|
if (*p != NUL) /* past group name */
|
||||||
{
|
{
|
||||||
include_link = FALSE;
|
include_link = 0;
|
||||||
if (arg[1] == 'i' && arg[0] == 'N')
|
if (arg[1] == 'i' && arg[0] == 'N')
|
||||||
highlight_list();
|
highlight_list();
|
||||||
if (STRNCMP("link", arg, p - arg) == 0
|
if (STRNCMP("link", arg, p - arg) == 0
|
||||||
@@ -9045,31 +9070,25 @@ get_highlight_name(xp, idx)
|
|||||||
expand_T *xp;
|
expand_T *xp;
|
||||||
int idx;
|
int idx;
|
||||||
{
|
{
|
||||||
if (idx == highlight_ga.ga_len
|
|
||||||
#ifdef FEAT_CMDL_COMPL
|
#ifdef FEAT_CMDL_COMPL
|
||||||
&& include_link
|
if (idx == highlight_ga.ga_len && include_none != 0)
|
||||||
#endif
|
return (char_u *)"none";
|
||||||
)
|
if (idx == highlight_ga.ga_len + include_none && include_default != 0)
|
||||||
return (char_u *)"link";
|
|
||||||
if (idx == highlight_ga.ga_len + 1
|
|
||||||
#ifdef FEAT_CMDL_COMPL
|
|
||||||
&& include_link
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
return (char_u *)"clear";
|
|
||||||
if (idx == highlight_ga.ga_len + 2
|
|
||||||
#ifdef FEAT_CMDL_COMPL
|
|
||||||
&& include_default
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
return (char_u *)"default";
|
return (char_u *)"default";
|
||||||
|
if (idx == highlight_ga.ga_len + include_none + include_default
|
||||||
|
&& include_link != 0)
|
||||||
|
return (char_u *)"link";
|
||||||
|
if (idx == highlight_ga.ga_len + include_none + include_default + 1
|
||||||
|
&& include_link != 0)
|
||||||
|
return (char_u *)"clear";
|
||||||
|
#endif
|
||||||
if (idx < 0 || idx >= highlight_ga.ga_len)
|
if (idx < 0 || idx >= highlight_ga.ga_len)
|
||||||
return NULL;
|
return NULL;
|
||||||
return HL_TABLE()[idx].sg_name;
|
return HL_TABLE()[idx].sg_name;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#if defined(FEAT_GUI) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Free all the highlight group fonts.
|
* Free all the highlight group fonts.
|
||||||
* Used when quitting for systems which need it.
|
* Used when quitting for systems which need it.
|
||||||
|
@@ -666,6 +666,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
36,
|
||||||
/**/
|
/**/
|
||||||
35,
|
35,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user