From e3f5b4421b6d2e53c29f596fe31bbca8f1b4ca0c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 7 Dec 2016 22:59:29 +0000 Subject: When reporting "whitespace at end of input line" on lines ending with roff(7) comments, let the column number in the message point to the end of the line rather than to the beginning of the comment. Improvement suggested by bluhm@. --- read.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/read.c b/read.c index d7a10803..851e9153 100644 --- a/read.c +++ b/read.c @@ -315,6 +315,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) const char *save_file; char *cp; size_t pos; /* byte number in the ln buffer */ + size_t j; /* auxiliary byte number in the blk buffer */ enum rofferr rr; int of; int lnn; /* line number in the real file */ @@ -420,6 +421,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) } if ('"' == blk.buf[i + 1] || '#' == blk.buf[i + 1]) { + j = i; i += 2; /* Comment, skip to end of line */ for (; i < blk.sz; ++i) { @@ -430,7 +432,7 @@ mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start) mandoc_msg( MANDOCERR_SPACE_EOL, curp, curp->line, - pos, NULL); + pos + i-1 - j, NULL); ++i; ++lnn; break; -- cgit