aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index bb7008b0ac..8e5a119b1f 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4009,10 +4009,10 @@ get_syn_options (
{
char_u *gname_start, *gname;
int syn_id;
- int len;
+ int len = 0;
char *p;
int fidx;
- static struct flag {
+ static const struct flag {
char *name;
int argtype;
int flags;
@@ -4035,7 +4035,7 @@ get_syn_options (
{"cCoOnNtTaAiInNsS", 1, 0},
{"cCoOnNtTaAiInNeEdDiInN", 2, 0},
{"nNeExXtTgGrRoOuUpP", 3, 0},};
- static char *first_letters = "cCoOkKeEtTsSgGdDfFnN";
+ static const char *const first_letters = "cCoOkKeEtTsSgGdDfFnN";
if (arg == NULL) /* already detected error */
return NULL;
@@ -4055,9 +4055,10 @@ get_syn_options (
for (fidx = ARRAY_SIZE(flagtab); --fidx >= 0; ) {
p = flagtab[fidx].name;
int i;
- for (i = 0, len = 0; p[i] != NUL; i += 2, ++len)
+ for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) {
if (arg[len] != p[i] && arg[len] != p[i + 1])
break;
+ }
if (p[i] == NUL && (ascii_iswhite(arg[len])
|| (flagtab[fidx].argtype > 0
? arg[len] == '='
@@ -6853,7 +6854,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (error && idx == highlight_ga.ga_len) {
syn_unadd_group();
} else {
- if (is_normal_group) {
+ if (!error && is_normal_group) {
// Need to update all groups, because they might be using "bg" and/or
// "fg", which have been changed now.
highlight_attr_set_all();