aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-04 17:47:18 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-04 17:47:18 +0000
commita203fd4e6f05d56d51d63d78b0357f1c67ffec39 (patch)
treeed23dfa1c237f1cd01f66b96ab8912beb1bcd018 /man_term.c
parentec66e073f559e3a2d8c56fd67060b2ccde12788a (diff)
downloadmandoc-a203fd4e6f05d56d51d63d78b0357f1c67ffec39.tar.gz
mandoc-a203fd4e6f05d56d51d63d78b0357f1c67ffec39.tar.zst
mandoc-a203fd4e6f05d56d51d63d78b0357f1c67ffec39.zip
Rounding rules for horizontal scaling widths are more complicated.
There is a first rounding to basic units on the input side. After that, rounding rules differ between requests and macros. Requests round to the nearest possible character position. Macros round to the next character position to the left. Implement that by changing the return value of term_hspan() to basic units and leaving the second scaling and rounding stage to the formatters instead of doing it in the terminal handler. Improves for example argtable2(3).
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/man_term.c b/man_term.c
index 8272456c..93b664a9 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.174 2015/04/04 11:44:43 schwarze Exp $ */
+/* $Id: man_term.c,v 1.175 2015/04/04 17:47:18 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -427,7 +427,7 @@ pre_in(DECL_ARGS)
if ( ! a2roffsu(++cp, &su, SCALE_EN))
return(0);
- v = term_hspan(p, &su);
+ v = (term_hspan(p, &su) + 11) / 24;
if (less < 0)
p->offset -= p->offset > v ? v : p->offset;
@@ -512,7 +512,7 @@ pre_HP(DECL_ARGS)
if ((nn = n->parent->head->child) != NULL &&
a2roffsu(nn->string, &su, SCALE_EN)) {
- len = term_hspan(p, &su);
+ len = term_hspan(p, &su) / 24;
if (len < 0 && (size_t)(-len) > mt->offset)
len = -mt->offset;
else if (len > SHRT_MAX)
@@ -597,7 +597,7 @@ pre_IP(DECL_ARGS)
if ((nn = n->parent->head->child) != NULL &&
(nn = nn->next) != NULL &&
a2roffsu(nn->string, &su, SCALE_EN)) {
- len = term_hspan(p, &su);
+ len = term_hspan(p, &su) / 24;
if (len < 0 && (size_t)(-len) > mt->offset)
len = -mt->offset;
else if (len > SHRT_MAX)
@@ -679,7 +679,7 @@ pre_TP(DECL_ARGS)
if ((nn = n->parent->head->child) != NULL &&
nn->string != NULL && ! (MAN_LINE & nn->flags) &&
a2roffsu(nn->string, &su, SCALE_EN)) {
- len = term_hspan(p, &su);
+ len = term_hspan(p, &su) / 24;
if (len < 0 && (size_t)(-len) > mt->offset)
len = -mt->offset;
else if (len > SHRT_MAX)
@@ -868,7 +868,7 @@ pre_RS(DECL_ARGS)
n = n->parent->head;
n->aux = SHRT_MAX + 1;
if (n->child != NULL && a2roffsu(n->child->string, &su, SCALE_EN))
- n->aux = term_hspan(p, &su);
+ n->aux = term_hspan(p, &su) / 24;
if (n->aux < 0 && (size_t)(-n->aux) > mt->offset)
n->aux = -mt->offset;
else if (n->aux > SHRT_MAX)