aboutsummaryrefslogtreecommitdiffstatshomepage
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
commiteee1390dda1a4f11d87431577c7c95163d5f60a5 (patch)
treebfd4c404a511c3347f250bce4bf8275bccd2b834 /mdoc_term.c
parent80a2117d1c762a36f59899a3fa11da69900d340b (diff)
downloadmandoc-eee1390dda1a4f11d87431577c7c95163d5f60a5.tar.gz
mandoc-eee1390dda1a4f11d87431577c7c95163d5f60a5.tar.zst
mandoc-eee1390dda1a4f11d87431577c7c95163d5f60a5.zip
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.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 0603b721..7f68c229 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.233 2011/07/22 10:50:46 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.234 2011/09/19 22:36:16 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
- }
}