source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: In flush-left mode of both man(7) and mdoc(7), when an output
Date: Mon, 16 Jul 2012 17:30:42 -0400 (EDT)	[thread overview]
Message-ID: <201207162130.q6GLUgdB029847@krisdoz.my.domain> (raw)

Log Message:
-----------
In flush-left mode of both man(7) and mdoc(7), when an output line is broken 
at the position of a literal tab, the tab indents the following line.
Fixes the perl(1) SYNOPSIS; reminded by deraadt@; OpenBSD rev. 1.66.

Modified Files:
--------------
    mdocml:
        TODO
        term.c

Revision Data
-------------
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.204
retrieving revision 1.205
diff -Lterm.c -Lterm.c -u -p -r1.204 -r1.205
--- term.c
+++ term.c
@@ -106,6 +106,7 @@ void
 term_flushln(struct termp *p)
 {
 	int		 i;     /* current input position in p->buf */
+	int		 ntab;	/* number of tabs to prepend */
 	size_t		 vis;   /* current visual position on output */
 	size_t		 vbl;   /* number of blanks to prepend to output */
 	size_t		 vend;	/* end of word visual position on output */
@@ -144,10 +145,12 @@ term_flushln(struct termp *p)
 		 * Handle literal tab characters: collapse all
 		 * subsequent tabs into a single huge set of spaces.
 		 */
+		ntab = 0;
 		while (i < p->col && '\t' == p->buf[i]) {
 			vend = (vis / p->tabwidth + 1) * p->tabwidth;
 			vbl += vend - vis;
 			vis = vend;
+			ntab++;
 			i++;
 		}
 
@@ -191,6 +194,11 @@ term_flushln(struct termp *p)
 				vend += p->rmargin - p->offset;
 			} else
 				vbl = p->offset;
+
+			/* use pending tabs on the new line */
+
+			if (0 < ntab)
+				vbl += ntab * p->tabwidth;
 
 			/* Remove the p->overstep width. */
 
Index: TODO
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/TODO,v
retrieving revision 1.136
retrieving revision 1.137
diff -LTODO -LTODO -u -p -r1.136 -r1.137
--- TODO
+++ TODO
@@ -169,9 +169,6 @@
   so far, we only have it in roff(7) and man(7)
   reminded by millert@  Thu, 09 Dec 2010 17:29:52 -0500
 
-- perl(1) SYNOPSIS looks bad; reported by deraadt@
-  1) man(7) seems to need SYNOPSIS .Nm blocks, too
-
 - In .Bl -column,
   .It Em Authentication<tab>Key Length
   ought to render "Key Length" with emphasis, too,
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2012-07-16 21:30 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=201207162130.q6GLUgdB029847@krisdoz.my.domain \
    --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).