From 296ca97e61f5c92e7b681de5cfbefd00df41afe0 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'read.c') diff --git a/read.c b/read.c index 39ff2337..1bb0f046 100644 --- a/read.c +++ b/read.c @@ -1,4 +1,4 @@ -/* $Id: read.c,v 1.153 2016/11/10 12:47:50 schwarze Exp $ */ +/* $Id: read.c,v 1.154 2016/12/07 22:59:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010-2016 Ingo Schwarze @@ -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 v1.2.3-56-ge451