rcfile: for an empty syntax, show the line number of the 'syntax' command

When reporting a syntax without any color commands, show the line number
of the relevant 'syntax' command instead of the line number where the
emptiness is concluded, because the latter can be many lines later.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
This commit is contained in:
Brand Huntsman 2019-07-08 20:54:04 -06:00 committed by Benno Schulenberg
parent e1c2573c7a
commit 304f07258b

View File

@ -362,8 +362,13 @@ void begin_new_syntax(char *ptr)
void check_for_nonempty_syntax(void)
{
#ifdef ENABLE_COLOR
if (opensyntax && !seen_color_command)
if (opensyntax && !seen_color_command) {
size_t current_lineno = lineno;
lineno = live_syntax->lineno;
jot_error(N_("Syntax \"%s\" has no color commands"), live_syntax->name);
lineno = current_lineno;
}
opensyntax = FALSE;
#endif