aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-16 14:38:12 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-16 14:38:12 +0000
commit5eda43815781d2f6dde50e670e33d155679e6c14 (patch)
treee8bdb93284bc51ddf71239ace764274ae03b8cdc /mdoc_term.c
parentbd8ae2e9c7b3b6677cfb59eecd2620e3819c3d99 (diff)
downloadmandoc-5eda43815781d2f6dde50e670e33d155679e6c14.tar.gz
mandoc-5eda43815781d2f6dde50e670e33d155679e6c14.tar.zst
mandoc-5eda43815781d2f6dde50e670e33d155679e6c14.zip
Surprisingly, groff does not support scaling units in .Bl -column
column width specifiers, so stop supporting them, too. As a side effect, this fixes an assertion failure that tb@ found with afl(1), triggered by: .Bl -column -4n
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 398fc3f5..bc125f29 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.344 2017/02/16 03:00:23 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.345 2017/02/16 14:38:12 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -606,6 +606,7 @@ termp_ll_pre(DECL_ARGS)
static int
termp_it_pre(DECL_ARGS)
{
+ struct roffsu su;
char buf[24];
const struct roff_node *bl, *nn;
size_t ncols, dcol;
@@ -683,9 +684,12 @@ termp_it_pre(DECL_ARGS)
for (i = 0, nn = n->prev;
nn->prev && i < (int)ncols;
- nn = nn->prev, i++)
- offset += dcol + a2width(p,
- bl->norm->Bl.cols[i]);
+ nn = nn->prev, i++) {
+ SCALE_HS_INIT(&su,
+ term_strlen(p, bl->norm->Bl.cols[i]));
+ su.scale /= term_strlen(p, "0");
+ offset += term_hspan(p, &su) / 24 + dcol;
+ }
/*
* When exceeding the declared number of columns, leave
@@ -700,7 +704,9 @@ termp_it_pre(DECL_ARGS)
* Use the declared column widths, extended as explained
* in the preceding paragraph.
*/
- width = a2width(p, bl->norm->Bl.cols[i]) + dcol;
+ SCALE_HS_INIT(&su, term_strlen(p, bl->norm->Bl.cols[i]));
+ su.scale /= term_strlen(p, "0");
+ width = term_hspan(p, &su) / 24 + dcol;
break;
default:
if (NULL == bl->norm->Bl.width)