This commit is contained in:
dvejmz
2018-01-09 22:58:24 +00:00
parent b23fc444b5
commit 34de6d33c9

View File

@@ -52,7 +52,7 @@ static bool did_syntax_onoff = false;
struct hl_group {
char_u *sg_name; ///< highlight group name
char_u *sg_name_u; ///< uppercase of sg_name
int sg_cleared; ///< "hi clear" was used
int sg_cleared; ///< "hi clear" was used
int sg_attr; ///< Screen attr @see ATTR_ENTRY
int sg_link; ///< link to this highlight group ID
int sg_set; ///< combination of flags in \ref SG_SET
@@ -3027,9 +3027,9 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing)
MSG(_("syn conceal off"));
}
} else if (STRNICMP(arg, "on", 2) == 0 && next - arg == 2) {
curwin->w_s->b_syn_conceal = TRUE;
curwin->w_s->b_syn_conceal = true;
} else if (STRNICMP(arg, "off", 3) == 0 && next - arg == 3) {
curwin->w_s->b_syn_conceal = FALSE;
curwin->w_s->b_syn_conceal = false;
} else {
EMSG2(_("E390: Illegal argument: %s"), arg);
}
@@ -3055,9 +3055,9 @@ static void syn_cmd_case(exarg_T *eap, int syncing)
MSG(_("syntax case match"));
}
} else if (STRNICMP(arg, "match", 5) == 0 && next - arg == 5) {
curwin->w_s->b_syn_ic = FALSE;
curwin->w_s->b_syn_ic = false;
} else if (STRNICMP(arg, "ignore", 6) == 0 && next - arg == 6) {
curwin->w_s->b_syn_ic = TRUE;
curwin->w_s->b_syn_ic = true;
} else {
EMSG2(_("E390: Illegal argument: %s"), arg);
}
@@ -3144,11 +3144,11 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
*/
void syntax_clear(synblock_T *block)
{
block->b_syn_error = FALSE; /* clear previous error */
block->b_syn_ic = FALSE; /* Use case, by default */
block->b_syn_spell = SYNSPL_DEFAULT; /* default spell checking */
block->b_syn_containedin = FALSE;
block->b_syn_conceal = FALSE;
block->b_syn_error = false; // clear previous error
block->b_syn_ic = false; // Use case, by default
block->b_syn_spell = SYNSPL_DEFAULT; // default spell checking
block->b_syn_containedin = false;
block->b_syn_conceal = false;
/* free the keywords */
clear_keywtab(&block->b_keywtab);
@@ -4025,11 +4025,11 @@ get_group_name (
* Return NULL for any error;
*/
static char_u *
get_syn_options (
char_u *arg, /* next argument to be checked */
syn_opt_arg_T *opt, /* various things */
get_syn_options(
char_u *arg, // next argument to be checked
syn_opt_arg_T *opt, // various things
int *conceal_char,
int skip /* TRUE if skipping over command */
int skip // TRUE if skipping over command
)
{
char_u *gname_start, *gname;
@@ -4105,14 +4105,17 @@ get_syn_options (
EMSG(_("E395: contains argument not accepted here"));
return NULL;
}
if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL)
if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) {
return NULL;
}
} else if (flagtab[fidx].argtype == 2) {
if (get_id_list(&arg, 11, &opt->cont_in_list, skip) == FAIL)
if (get_id_list(&arg, 11, &opt->cont_in_list, skip) == FAIL) {
return NULL;
}
} else if (flagtab[fidx].argtype == 3) {
if (get_id_list(&arg, 9, &opt->next_list, skip) == FAIL)
if (get_id_list(&arg, 9, &opt->next_list, skip) == FAIL) {
return NULL;
}
} else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
/* cchar=? */
if (has_mbyte) {
@@ -4410,10 +4413,11 @@ syn_cmd_match (
init_syn_patterns();
memset(&item, 0, sizeof(item));
rest = get_syn_pattern(rest, &item);
if (vim_regcomp_had_eol() && !(syn_opt_arg.flags & HL_EXCLUDENL))
if (vim_regcomp_had_eol() && !(syn_opt_arg.flags & HL_EXCLUDENL)) {
syn_opt_arg.flags |= HL_HAS_EOL;
}
/* Get options after the pattern */
// Get options after the pattern
rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest != NULL) { /* all arguments are valid */
@@ -4526,14 +4530,13 @@ syn_cmd_region (
syn_opt_arg.cont_in_list = NULL;
syn_opt_arg.next_list = NULL;
/*
* get the options, patterns and matchgroup.
*/
// get the options, patterns and matchgroup.
while (rest != NULL && !ends_excmd(*rest)) {
/* Check for option arguments */
// Check for option arguments
rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest == NULL || ends_excmd(*rest))
if (rest == NULL || ends_excmd(*rest)) {
break;
}
/* must be a pattern or matchgroup then */
key_end = rest;
@@ -4963,7 +4966,7 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
syn_combine_list(&SYN_CLSTR(curwin->w_s)[scl_id].scl_list,
&clstr_list, list_op);
}
got_clstr = TRUE;
got_clstr = true;
}
if (got_clstr) {
@@ -5211,9 +5214,9 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
static int
get_id_list (
char_u **arg,
int keylen, /* length of keyword */
short **list, /* where to store the resulting list, if not
NULL, the list is silently skipped! */
int keylen, // length of keyword
int16_t **list, // where to store the resulting list, if not
// NULL, the list is silently skipped!
int skip
)
{
@@ -6493,7 +6496,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
HL_TABLE()[from_id - 1].sg_set |= SG_LINK;
HL_TABLE()[from_id - 1].sg_link = to_id;
HL_TABLE()[from_id - 1].sg_scriptID = current_SID;
HL_TABLE()[from_id - 1].sg_cleared = false;
HL_TABLE()[from_id - 1].sg_cleared = false;
redraw_all_later(SOME_VALID);
}
}
@@ -7774,14 +7777,14 @@ const char *get_highlight_name(expand_T *const xp, const int idx)
return NULL;
}
/* Items are never removed from the table, skip the ones that were cleared.
*/
int current_idx = idx;
while (current_idx < highlight_ga.ga_len && HL_TABLE()[current_idx].sg_cleared) {
++current_idx;
// Items are never removed from the table, skip the ones that were cleared.
int current_idx = idx;
while (current_idx < highlight_ga.ga_len
&& HL_TABLE()[current_idx].sg_cleared) {
current_idx++;
}
if (current_idx >= highlight_ga.ga_len) {
return NULL;
return NULL;
}
return (const char *)HL_TABLE()[current_idx].sg_name;
}