summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-09-19 22:36:16 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-09-19 22:36:16 +0000
commitbbc1c34dd91da0a6589b4a76b4c861db09eeab42 (patch)
tree966b48c25d489fc44a0d9043441dd82db45f5cad /mdoc_term.c
parent8c76f32c930d4fac4fe4b05aacc9b57b7e190516 (diff)
downloadmandoc-bbc1c34dd91da0a6589b4a76b4c861db09eeab42.tar.gz
Remove the terminal frontend flag TERMP_NOLPAD.
In columnated contexts (.Bl -column, .Bl -tag, .IP, .TP, .HP etc.), do not pad after writing a column. Instead, always pad before writing content. In itself, this change avoids: - writing trailing whitespace in some situations - with .fi/.nf in .HP, breaking lines that were already padded It allows several bugfixes included in this patch: - Do not count backspace as a character with positive width. - Set up proper indentation when encountering .fi/.nf in .HP. - Adjust the .HP indentation width to what groff does. - Never unlimit the right margin unless in the final column. ok kristaps@
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 5e77aa1b..b0bea6b2 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -435,7 +435,7 @@ print_mdoc_foot(struct termp *p, const void *arg)
p->offset = p->rmargin;
p->rmargin = p->maxrmargin - term_strlen(p, m->os);
- p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
+ p->flags |= TERMP_NOSPACE;
term_word(p, m->date);
term_flushln(p);
@@ -443,7 +443,7 @@ print_mdoc_foot(struct termp *p, const void *arg)
p->offset = p->rmargin;
p->rmargin = p->maxrmargin;
p->flags &= ~TERMP_NOBREAK;
- p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
+ p->flags |= TERMP_NOSPACE;
term_word(p, m->os);
term_flushln(p);
@@ -499,7 +499,7 @@ print_mdoc_head(struct termp *p, const void *arg)
p->offset = p->rmargin;
p->rmargin = p->maxrmargin - term_strlen(p, title);
- p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
+ p->flags |= TERMP_NOSPACE;
term_word(p, buf);
term_flushln(p);
@@ -507,7 +507,7 @@ print_mdoc_head(struct termp *p, const void *arg)
p->offset = p->rmargin;
p->rmargin = p->maxrmargin;
p->flags &= ~TERMP_NOBREAK;
- p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
+ p->flags |= TERMP_NOSPACE;
term_word(p, title);
term_flushln(p);
@@ -787,16 +787,11 @@ termp_it_pre(DECL_ARGS)
case (LIST_hyphen):
if (MDOC_HEAD == n->type)
p->flags |= TERMP_NOBREAK;
- else
- p->flags |= TERMP_NOLPAD;
break;
case (LIST_hang):
if (MDOC_HEAD == n->type)
p->flags |= TERMP_NOBREAK;
else
- p->flags |= TERMP_NOLPAD;
-
- if (MDOC_HEAD != n->type)
break;
/*
@@ -807,17 +802,14 @@ termp_it_pre(DECL_ARGS)
*/
if (n->next->child &&
(MDOC_Bl == n->next->child->tok ||
- MDOC_Bd == n->next->child->tok)) {
+ MDOC_Bd == n->next->child->tok))
p->flags &= ~TERMP_NOBREAK;
- p->flags &= ~TERMP_NOLPAD;
- } else
+ else
p->flags |= TERMP_HANG;
break;
case (LIST_tag):
if (MDOC_HEAD == n->type)
p->flags |= TERMP_NOBREAK | TERMP_TWOSPACE;
- else
- p->flags |= TERMP_NOLPAD;
if (MDOC_HEAD != n->type)
break;
@@ -833,10 +825,6 @@ termp_it_pre(DECL_ARGS)
else
p->flags |= TERMP_NOBREAK;
- assert(n->prev);
- if (MDOC_BODY == n->prev->type)
- p->flags |= TERMP_NOLPAD;
-
break;
case (LIST_diag):
if (MDOC_HEAD == n->type)
@@ -993,7 +981,6 @@ termp_it_post(DECL_ARGS)
p->flags &= ~TERMP_DANGLE;
p->flags &= ~TERMP_NOBREAK;
p->flags &= ~TERMP_TWOSPACE;
- p->flags &= ~TERMP_NOLPAD;
p->flags &= ~TERMP_HANG;
}
@@ -1009,7 +996,7 @@ termp_nm_pre(DECL_ARGS)
if (MDOC_BODY == n->type) {
if (NULL == n->child)
return(0);
- p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
+ p->flags |= TERMP_NOSPACE;
p->offset += term_len(p, 1) +
(NULL == n->prev->child ? term_strlen(p, m->name) :
MDOC_TEXT == n->prev->child->type ?
@@ -1054,10 +1041,8 @@ termp_nm_post(DECL_ARGS)
if (MDOC_HEAD == n->type && n->next->child) {
term_flushln(p);
p->flags &= ~(TERMP_NOBREAK | TERMP_HANG);
- } else if (MDOC_BODY == n->type && n->child) {
+ } else if (MDOC_BODY == n->type && n->child)
term_flushln(p);
- p->flags &= ~TERMP_NOLPAD;
- }
}