]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc_term.c
Smarten BADCHAR check to allow ASCII_HYPH.
[mandoc.git] / mdoc_term.c
index d11e36e0c6bcc91894052782330655bd342cb54e..3503483af294e9fea933c53c65abc05f2beec2d7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: mdoc_term.c,v 1.126 2010/05/17 23:57:06 kristaps Exp $ */
+/*     $Id: mdoc_term.c,v 1.130 2010/05/24 21:51:20 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -274,6 +274,7 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
 
        p->overstep = 0;
        p->maxrmargin = p->defrmargin;
+       p->tabwidth = 5;
 
        if (NULL == p->symtab)
                switch (p->enc) {
@@ -613,7 +614,7 @@ print_bvspace(struct termp *p,
 
        /* A `-column' does not assert vspace within the list. */
 
-       if (MDOC_Bl == bl->tok && LIST_diag == bl->data.list)
+       if (MDOC_Bl == bl->tok && LIST_column == bl->data.list)
                if (n->prev && MDOC_It == n->prev->tok)
                        return;
 
@@ -1013,14 +1014,14 @@ termp_it_post(DECL_ARGS)
                /* FALLTHROUGH */
        case (LIST_inset):
                if (MDOC_BODY == n->type)
-                       term_flushln(p);
+                       term_newln(p);
                break;
        case (LIST_column):
                if (MDOC_HEAD == n->type)
                        term_flushln(p);
                break;
        default:
-               term_flushln(p);
+               term_newln(p);
                break;
        }
 
@@ -1044,6 +1045,7 @@ termp_nm_pre(DECL_ARGS)
 {
 
        if (NULL == n->child && NULL == m->name)
+               return(1);
 
        if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags)
                term_newln(p);
@@ -1592,6 +1594,7 @@ termp_fa_pre(DECL_ARGS)
 static int
 termp_bd_pre(DECL_ARGS)
 {
+       size_t                   tabwidth;
        int                      i, type;
        size_t                   rm, rmax;
        const struct mdoc_node  *nn;
@@ -1621,6 +1624,8 @@ termp_bd_pre(DECL_ARGS)
        if (MDOC_Literal != type && MDOC_Unfilled != type)
                return(1);
 
+       tabwidth = p->tabwidth;
+       p->tabwidth = 8;
        rm = p->rmargin;
        rmax = p->maxrmargin;
        p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
@@ -1628,13 +1633,12 @@ termp_bd_pre(DECL_ARGS)
        for (nn = n->child; nn; nn = nn->next) {
                p->flags |= TERMP_NOSPACE;
                print_mdoc_node(p, pair, m, nn);
-               if (NULL == nn->next)
-                       continue;
-               if (nn->prev && nn->prev->line < nn->line)
-                       term_flushln(p);
-               else if (NULL == nn->prev)
+               if (NULL == nn->prev ||
+                   nn->prev->line < nn->line ||
+                   NULL == nn->next)
                        term_flushln(p);
        }
+       p->tabwidth = tabwidth;
 
        p->rmargin = rm;
        p->maxrmargin = rmax;
@@ -1662,7 +1666,7 @@ termp_bd_post(DECL_ARGS)
                p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
 
        p->flags |= TERMP_NOSPACE;
-       term_flushln(p);
+       term_newln(p);
 
        p->rmargin = rm;
        p->maxrmargin = rmax;