source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: When reporting "whitespace at end of input line" on lines ending
Date: Wed, 7 Dec 2016 17:59:59 -0500 (EST)	[thread overview]
Message-ID: <15601064335359450547.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
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@.

Modified Files:
--------------
    mdocml:
        read.c

Revision Data
-------------
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -Lread.c -Lread.c -u -p -r1.153 -r1.154
--- read.c
+++ read.c
@@ -315,6 +315,7 @@ mparse_buf_r(struct mparse *curp, struct
 	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
 			}
 
 			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
 						mandoc_msg(
 						    MANDOCERR_SPACE_EOL,
 						    curp, curp->line,
-						    pos, NULL);
+						    pos + i-1 - j, NULL);
 					++i;
 					++lnn;
 					break;
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2016-12-07 22:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15601064335359450547.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).