commit 304f07258b7eadc71752ee46507f5d2131117079
parent e1c2573c7a75bc6c9969a9b84590d15b56a95669
Author: Brand Huntsman <alpha@qzx.com>
Date: Mon, 8 Jul 2019 20:54:04 -0600
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>
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -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