source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: When the HEAD of an .Nm block in the SYNOPSIS might be wider
@ 2010-09-23 20:40 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2010-09-23 20:40 UTC (permalink / raw)
  To: source

Log Message:
-----------
When the HEAD of an .Nm block in the SYNOPSIS might be wider  
than the column containing it, the TERMP_HANG flag is required,
but avoid the flag when we know that the HEAD is shorter, 
because in that case, the flag might ruin the alignment.

Problem originally reported by jmc@, who also spotted a regression
in an earlier version of this patch.

"feel free to commit" kristaps@

Modified Files:
--------------
    mdocml:
        mdoc_term.c

Revision Data
-------------
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.184
retrieving revision 1.185
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.184 -r1.185
--- mdoc_term.c
+++ mdoc_term.c
@@ -1031,12 +1031,18 @@ termp_nm_pre(DECL_ARGS)
 		synopsis_pre(p, n->parent);
 
 	if (MDOC_HEAD == n->type && n->next->child) {
-		p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_HANG;
-		p->rmargin = p->offset + term_len(p, 1) +
-		    (NULL == n->child ? term_strlen(p, m->name) :
-		     MDOC_TEXT == n->child->type ?
-			term_strlen(p, n->child->string) :
-		     term_len(p, 5));
+		p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
+		p->rmargin = p->offset + term_len(p, 1);
+		if (NULL == n->child) {
+			p->rmargin += term_strlen(p, m->name);
+		} else if (MDOC_TEXT == n->child->type) {
+			p->rmargin += term_strlen(p, n->child->string);
+			if (n->child->next)
+				p->flags |= TERMP_HANG;
+		} else {
+			p->rmargin += term_len(p, 5);
+			p->flags |= TERMP_HANG;
+		}
 	}
 
 	term_fontpush(p, TERMFONT_BOLD);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-09-23 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-23 20:40 mdocml: When the HEAD of an .Nm block in the SYNOPSIS might be wider schwarze

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).