#ifdef FEAT_STL_OPT
/*
* Check validity of options with the 'statusline' format.
- * Return error message or NULL.
+ * Return an untranslated error message or NULL.
*/
static char *
check_stl_option(char_u *s)
}
if (*s == '{')
{
- int reevaluate = (*s == '%');
+ int reevaluate = (*++s == '%');
- s++;
+ if (reevaluate && *++s == '}')
+ // "}" is not allowed immediately after "%{%"
+ return illegal_char(errbuf, '}');
while ((*s != '}' || (reevaluate && s[-1] != '%')) && *s)
s++;
if (*s != '}')
- return N_(e_unclosed_expression_sequence);
+ return e_unclosed_expression_sequence;
}
}
if (groupdepth != 0)
- return N_(e_unbalanced_groups);
+ return e_unbalanced_groups;
return NULL;
}
#endif
}
#ifdef FEAT_STL_OPT
- // 'statusline' or 'rulerformat'
- else if (gvarp == &p_stl || varp == &p_ruf)
+ // 'statusline', 'tabline' or 'rulerformat'
+ else if (gvarp == &p_stl || varp == &p_tal || varp == &p_ruf)
{
int wid;
else
errmsg = check_stl_option(p_ruf);
}
- // check 'statusline' only if it doesn't start with "%!"
+ // check 'statusline' or 'tabline' only if it doesn't start with "%!"
else if (varp == &p_ruf || s[0] != '%' || s[1] != '!')
errmsg = check_stl_option(s);
if (varp == &p_ruf && errmsg == NULL)
call assert_fails('set rulerformat=%15(%%', 'E542:')
call assert_fails('set statusline=%$', 'E539:')
call assert_fails('set statusline=%{', 'E540:')
+ call assert_fails('set statusline=%{%', 'E540:')
+ call assert_fails('set statusline=%{%}', 'E539:')
call assert_fails('set statusline=%(', 'E542:')
call assert_fails('set statusline=%)', 'E542:')
+ call assert_fails('set tabline=%$', 'E539:')
+ call assert_fails('set tabline=%{', 'E540:')
+ call assert_fails('set tabline=%{%', 'E540:')
+ call assert_fails('set tabline=%{%}', 'E539:')
+ call assert_fails('set tabline=%(', 'E542:')
+ call assert_fails('set tabline=%)', 'E542:')
if has('cursorshape')
" This invalid value for 'guicursor' used to cause Vim to crash.