source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Fix spacing for tables to use term_len().
@ 2011-01-04 13:14 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-01-04 13:14 UTC (permalink / raw)
  To: source

Log Message:
-----------
Fix spacing for tables to use term_len().  Also make term.c properly
recode ASCII_HYPHEN and ASCII_NBRSP before passing back for widths.

Modified Files:
--------------
    mdocml:
        index.sgml
        tbl_term.c
        term.c

Revision Data
-------------
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -Lterm.c -Lterm.c -u -p -r1.175 -r1.176
--- term.c
+++ term.c
@@ -677,6 +677,12 @@ term_strlen(const struct termp *p, const
 			if (rhs)
 				for (i = 0; i < rsz; i++)
 					sz += (*p->width)(p, *rhs++);
+		} else if (ASCII_NBRSP == *cp) {
+			sz += (*p->width)(p, ' ');
+			cp++;
+		} else if (ASCII_HYPH == *cp) {
+			sz += (*p->width)(p, '-');
+			cp++;
 		} else
 			sz += (*p->width)(p, *cp++);
 
Index: tbl_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl_term.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Ltbl_term.c -Ltbl_term.c -u -p -r1.7 -r1.8
--- tbl_term.c
+++ tbl_term.c
@@ -206,9 +206,6 @@ tbl_hframe(struct termp *tp, const struc
 			TBL_OPT_DBOX & sp->tbl->opts))
 		return;
 
-	tp->flags |= TERMP_NONOSPACE;
-	tp->flags |= TERMP_NOSPACE;
-
 	/* 
 	 * Print out the horizontal part of a frame or double frame.  A
 	 * double frame has an unbroken `-' outer line the width of the
@@ -465,7 +462,7 @@ tbl_calc_data(struct termp *tp, const st
 	case (TBL_CELL_HORIZ):
 		/* FALLTHROUGH */
 	case (TBL_CELL_DHORIZ):
-		tblp->width = 1;
+		tblp->width = term_len(tp, 1);
 		break;
 	case (TBL_CELL_LONG):
 		/* FALLTHROUGH */
@@ -536,7 +533,7 @@ tbl_calc_data_literal(struct termp *tp, 
 		const struct tbl_dat *dp, 
 		struct termp_tbl *tblp)
 {
-	int		 sz, bufsz;
+	int		 sz, bufsz, spsz;
 
 	/* 
 	 * Calculate our width and use the spacing, with a minimum
@@ -551,16 +548,19 @@ tbl_calc_data_literal(struct termp *tp, 
 	case (TBL_CELL_LONG):
 		/* FALLTHROUGH */
 	case (TBL_CELL_CENTRE):
-		bufsz = 2;
+		bufsz = term_len(tp, 2);
 		break;
 	default:
-		bufsz = 1;
+		bufsz = term_len(tp, 1);
 		break;
 	}
 
+	spsz = 0;
 	if (dp->layout->spacing)
-		bufsz = bufsz > dp->layout->spacing ? 
-			bufsz : dp->layout->spacing;
+		spsz = term_len(tp, dp->layout->spacing);
+
+	if (spsz)
+		bufsz = bufsz > spsz ?  bufsz : spsz;
 
 	sz += bufsz;
 	if (tblp->width < sz)
Index: index.sgml
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/index.sgml,v
retrieving revision 1.100
retrieving revision 1.101
diff -Lindex.sgml -Lindex.sgml -u -p -r1.100 -r1.101
--- index.sgml
+++ index.sgml
@@ -331,10 +331,11 @@
 							version 1.10.9
 						</P>
 						<P>
-							Table functionality (see the <A HREF="roff.7.html#x5c265453">roff</A> manual) has been
-							merged from <A CLASS="external" HREF="http://tbl.bsd.lv">tbl.bsd.lv</A>.  Many back-end
-							fixes have also been implemented, primarily in argument handling (quoting) and <A
-							HREF="man.7.html">man</A> documents.
+							Table functionality (see the <Q>TS</Q>, <Q>TE</Q>, and <Q>T&amp;</Q> macros in the <A
+							HREF="roff.7.html#x5c265453">roff</A> manual) has been merged from <A CLASS="external"
+							HREF="http://tbl.bsd.lv">tbl.bsd.lv</A>.  Many back-end fixes have also been
+							implemented, primarily in argument handling (quoting) and <A HREF="man.7.html">man</A>
+							documents.
 						</P>
 					</DIV>
 					<DIV CLASS="news">
--
 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:[~2011-01-04 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-04 13:14 mdocml: Fix spacing for tables to use term_len() kristaps

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