aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-06-13 14:39:13 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-06-13 14:39:13 +0000
commit4e4b238b9de9ce600428b3f232d40a6e9bac4a17 (patch)
tree1429b8c782d9483a720701a032b86c8584652fe1 /tbl_term.c
parent15d0494a307f70b4e1f9e676dd38e057228d319d (diff)
downloadmandoc-4e4b238b9de9ce600428b3f232d40a6e9bac4a17.tar.gz
mandoc-4e4b238b9de9ce600428b3f232d40a6e9bac4a17.tar.zst
mandoc-4e4b238b9de9ce600428b3f232d40a6e9bac4a17.zip
fix the interaction of the allbox option with spanned cells in the layout
Diffstat (limited to 'tbl_term.c')
-rw-r--r--tbl_term.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/tbl_term.c b/tbl_term.c
index 9a4007f5..4104f0ad 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -1,4 +1,4 @@
-/* $Id: tbl_term.c,v 1.50 2017/06/12 22:49:16 schwarze Exp $ */
+/* $Id: tbl_term.c,v 1.51 2017/06/13 14:39:13 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011,2012,2014,2015,2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -219,29 +219,44 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
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;