From 1c03e5775018d991f4ca1e5e72ee2b40371d9da1 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 07 Oct 2018 11:25:43 -0400 Subject: [PATCH] Error if formatting continues to next paragraph This prevents the inevitable "nested formatting" error from being too far away from the source of the issue. --- src/main.c | 9 +++++++++ diff --git a/src/main.c b/src/main.c index b0835d16000486456e20c053ec703f917a955376..75600be3b55229526d58fee30dd68c12e9c9e52e 100644 --- a/src/main.c +++ b/src/main.c @@ -578,6 +578,15 @@ case ' ': parser_fatal(p, "Tabs are required for indentation"); break; case '\n': + if (p->flags) { + char error[512]; + snprintf(error, sizeof(error), "Expected %c before starting " + "new paragraph (began with %c at %d:%d)", + p->flags == FORMAT_BOLD ? '*' : '_', + p->flags == FORMAT_BOLD ? '*' : '_', + p->fmt_line, p->fmt_col); + parser_fatal(p, error); + } roff_macro(p, "P", NULL); break; default: -- 2.48.1