summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-12 22:48:53 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-06-12 22:48:53 +0000
commit122076f50fa024ce2383118cffc4931202dc4b8a (patch)
tree44661376a3fbd17cf6d75e976ed269a2dc5b95d1
parentbd8d82e5d704824e5a834262d6b460961e641d71 (diff)
Two minor fixes for the "allbox" modifier:
1. It does not reduce explicit "||" in the layout to "|". 2. It does not cause three horizontal lines at the end of a table, even if the table ends with an explicit "_" data line.
-rw-r--r--usr.bin/mandoc/tbl_term.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/mandoc/tbl_term.c b/usr.bin/mandoc/tbl_term.c
index 8ad09633152..9c5d8aec5f2 100644
--- a/usr.bin/mandoc/tbl_term.c
+++ b/usr.bin/mandoc/tbl_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tbl_term.c,v 1.37 2017/06/12 20:44:57 schwarze Exp $ */
+/* $OpenBSD: tbl_term.c,v 1.38 2017/06/12 22:48:52 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011,2012,2014,2015,2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -240,7 +240,8 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
cp = cp->next;
} else
vert = 0;
- if (sp->opts->opts & TBL_OPT_ALLBOX)
+ if (vert == 0 &&
+ sp->opts->opts & TBL_OPT_ALLBOX)
vert = 1;
if (vert == 0)
continue;
@@ -300,7 +301,9 @@ term_tbl(struct termp *tp, const struct tbl_span *sp)
free(tp->tbl.cols);
tp->tbl.cols = NULL;
tp->tcol->offset = offset;
- } else if (horiz == 0 && sp->opts->opts & TBL_OPT_ALLBOX)
+ } else if (horiz == 0 && sp->opts->opts & TBL_OPT_ALLBOX &&
+ (sp->next == NULL || sp->next->pos == TBL_SPAN_DATA ||
+ sp->next->next != NULL))
tbl_hrule(tp, sp, 1);
tp->flags &= ~TERMP_NONOSPACE;