diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2016-12-07 22:59:29 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2016-12-07 22:59:29 +0000 |
commit | 296ca97e61f5c92e7b681de5cfbefd00df41afe0 (patch) | |
tree | c00a54af6d2136181a8fca72d540b36ea4a3d8b2 | |
parent | b0f4d52ef05e276a63213d952725f0aca8b4592e (diff) | |
download | mandoc-296ca97e61f5c92e7b681de5cfbefd00df41afe0.tar.gz mandoc-296ca97e61f5c92e7b681de5cfbefd00df41afe0.tar.zst mandoc-296ca97e61f5c92e7b681de5cfbefd00df41afe0.zip |
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@.
-rw-r--r-- | read.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 <kristaps@bsd.lv> * Copyright (c) 2010-2016 Ingo Schwarze <schwarze@openbsd.org> @@ -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; |