source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: fix the interaction of the allbox option with spanned cells in
@ 2017-06-13 14:39 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-06-13 14:39 UTC (permalink / raw)
  To: source

Log Message:
-----------
fix the interaction of the allbox option with spanned cells in the layout

Modified Files:
--------------
    mdocml:
        tbl_term.c
    mdocml/regress/tbl/layout:
        span.in
        span.out_ascii

Revision Data
-------------
Index: tbl_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/tbl_term.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -Ltbl_term.c -Ltbl_term.c -u -p -r1.50 -r1.51
--- tbl_term.c
+++ tbl_term.c
@@ -219,29 +219,44 @@ term_tbl(struct termp *tp, const struct 
 			dp = sp->first;
 			spans = 0;
 			for (ic = 0; ic < sp->opts->cols; ic++) {
-				if (spans == 0) {
-					tp->tcol++;
-					if (dp != NULL) {
-						spans = dp->spans;
-						dp = dp->next;
-					}
-					if (tp->tcol->col < tp->tcol->lastcol)
-						term_flushln(tp);
-					if (tp->tcol->col < tp->tcol->lastcol)
-						more = 1;
-					if (tp->tcol + 1 ==
-					    tp->tcols + tp->lasttcol)
-						continue;
-				} else
-					spans--;
 
-				/* Vertical frames between data cells. */
+				/* Advance to next layout cell. */
 
 				if (cp != NULL) {
 					vert = cp->vert;
 					cp = cp->next;
 				} else
 					vert = 0;
+
+				/* Skip later cells in a span. */
+
+				if (spans) {
+					spans--;
+					continue;
+				}
+
+				/* Advance to next data cell. */
+
+				if (dp != NULL) {
+					spans = dp->spans;
+					dp = dp->next;
+				}
+
+				/* Print one line of text in the cell. */
+
+				tp->tcol++;
+				if (tp->tcol->col < tp->tcol->lastcol)
+					term_flushln(tp);
+				if (tp->tcol->col < tp->tcol->lastcol)
+					more = 1;
+
+				/*
+				 * Vertical frames between data cells,
+				 * but not after the last column.
+				 */
+
+				if (tp->tcol + 1 == tp->tcols + tp->lasttcol)
+					continue;
 				if (vert == 0 &&
 				    sp->opts->opts & TBL_OPT_ALLBOX)
 					vert = 1;
Index: span.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/layout/span.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/layout/span.out_ascii -Lregress/tbl/layout/span.out_ascii -u -p -r1.1 -r1.2
--- regress/tbl/layout/span.out_ascii
+++ regress/tbl/layout/span.out_ascii
@@ -29,5 +29,13 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
        |a   b       s |
        +--------------+
 
+       +--+---+---+---+---+
+       |a | b | c | d | e |
+       +--+---+---+---+---+
+       |   s1     |  s2   |
+       +--+---+---+---+---+
+       |a | b | c | d | e |
+       +--+---+---+---+---+
+
 
                                                             TBL-LAYOUT-SPAN(1)
Index: span.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/tbl/layout/span.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/tbl/layout/span.in -Lregress/tbl/layout/span.in -u -p -r1.1 -r1.2
--- regress/tbl/layout/span.in
+++ regress/tbl/layout/span.in
@@ -38,3 +38,13 @@ s:c:d
 a:s:d
 a:b:s
 .TE
+.sp
+.TS
+allbox tab(:);
+L L L L L
+C S S C S
+R R R R R.
+a:b:c:d:e
+s1:s2
+a:b:c:d:e
+.TE
--
 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:[~2017-06-13 14:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13 14:39 mdocml: fix the interaction of the allbox option with spanned cells in 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).