summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-23 09:31:46 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-23 09:31:46 +0000
commit83592bae7b4cc86364128d1a37075c8d2ab3f14f (patch)
tree0c4bbf3561d1fd7d3645e88846d2a774680001dc /mdoc_term.c
parentce8ab0a1bb72b1a1bf7fbc11edfcad682e7d1619 (diff)
downloadmandoc-83592bae7b4cc86364128d1a37075c8d2ab3f14f.tar.gz
some scaling unit fixes:
- .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index e940ab9d..4a8ddb86 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -50,7 +50,6 @@ struct termact {
};
static size_t a2width(const struct termp *, const char *);
-static size_t a2height(const struct termp *, const char *);
static void print_bvspace(struct termp *,
const struct mdoc_node *,
@@ -527,25 +526,11 @@ print_mdoc_head(struct termp *p, const void *arg)
}
static size_t
-a2height(const struct termp *p, const char *v)
-{
- struct roffsu su;
-
-
- assert(v);
- if ( ! a2roffsu(v, &su, SCALE_VS))
- SCALE_VS_INIT(&su, atoi(v));
-
- return(term_vspan(p, &su));
-}
-
-static size_t
a2width(const struct termp *p, const char *v)
{
struct roffsu su;
- assert(v);
- if ( ! a2roffsu(v, &su, SCALE_MAX)) {
+ if (a2roffsu(v, &su, SCALE_MAX) < 2) {
SCALE_HS_INIT(&su, term_strlen(p, v));
su.scale /= term_strlen(p, "0");
}
@@ -1816,11 +1801,17 @@ termp_in_post(DECL_ARGS)
static int
termp_sp_pre(DECL_ARGS)
{
+ struct roffsu su;
size_t i, len;
switch (n->tok) {
case MDOC_sp:
- len = n->child ? a2height(p, n->child->string) : 1;
+ if (n->child) {
+ if ( ! a2roffsu(n->child->string, &su, SCALE_VS))
+ su.scale = 1.0;
+ len = term_vspan(p, &su);
+ } else
+ len = 1;
break;
case MDOC_br:
len = 0;