=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.118 retrieving revision 1.124 diff -u -p -r1.118 -r1.124 --- mandoc/mdoc_term.c 2010/05/09 16:05:13 1.118 +++ mandoc/mdoc_term.c 2010/05/15 16:24:38 1.124 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.118 2010/05/09 16:05:13 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.124 2010/05/15 16:24:38 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -273,7 +273,7 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc) p = (struct termp *)arg; p->overstep = 0; - p->maxrmargin = 78; + p->maxrmargin = p->defrmargin; if (NULL == p->symtab) switch (p->enc) { @@ -337,6 +337,9 @@ print_mdoc_node(DECL_ARGS) if (termacts[n->tok].post) (*termacts[n->tok].post)(p, &npair, m, n); + if (MDOC_EOS & n->flags) + p->flags |= TERMP_SENTENCE; + p->offset = offset; p->rmargin = rmargin; } @@ -422,7 +425,7 @@ print_mdoc_head(DECL_ARGS) strlcat(buf, ")", BUFSIZ); } - snprintf(title, BUFSIZ, "%s(%d)", m->title, m->msec); + snprintf(title, BUFSIZ, "%s(%s)", m->title, m->msec); p->offset = 0; p->rmargin = (p->maxrmargin - strlen(buf) + 1) / 2; @@ -1082,7 +1085,7 @@ static int termp_nm_pre(DECL_ARGS) { - if (SEC_SYNOPSIS == n->sec) + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) term_newln(p); term_fontpush(p, TERMFONT_BOLD); @@ -1381,7 +1384,7 @@ static void termp_fd_post(DECL_ARGS) { - if (n->sec != SEC_SYNOPSIS) + if (n->sec != SEC_SYNOPSIS || ! (MDOC_LINE & n->flags)) return; term_newln(p); @@ -1468,7 +1471,7 @@ static void termp_lb_post(DECL_ARGS) { - if (SEC_LIBRARY == n->sec) + if (SEC_LIBRARY == n->sec && MDOC_LINE & n->flags) term_newln(p); } @@ -1537,7 +1540,7 @@ static int termp_ft_pre(DECL_ARGS) { - if (SEC_SYNOPSIS == n->sec) + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) if (n->prev && MDOC_Fo == n->prev->tok) term_vspace(p); @@ -1551,7 +1554,7 @@ static void termp_ft_post(DECL_ARGS) { - if (SEC_SYNOPSIS == n->sec) + if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) term_newln(p); } @@ -1592,7 +1595,7 @@ static void termp_fn_post(DECL_ARGS) { - if (n->sec == SEC_SYNOPSIS && n->next) + if (n->sec == SEC_SYNOPSIS && n->next && MDOC_LINE & n->flags) term_vspace(p); } @@ -1629,7 +1632,7 @@ static int termp_bd_pre(DECL_ARGS) { int i, type; - size_t sv; + size_t rm, rmax; const struct mdoc_node *nn; if (MDOC_BLOCK == n->type) { @@ -1657,8 +1660,9 @@ termp_bd_pre(DECL_ARGS) if (MDOC_Literal != type && MDOC_Unfilled != type) return(1); - sv = p->rmargin; - p->rmargin = 100000; /* FIXME */ + rm = p->rmargin; + rmax = p->maxrmargin; + p->rmargin = p->maxrmargin = TERM_MAXMARGIN; for (nn = n->child; nn; nn = nn->next) { p->flags |= TERMP_NOSPACE; @@ -1671,7 +1675,8 @@ termp_bd_pre(DECL_ARGS) term_flushln(p); } - p->rmargin = sv; + p->rmargin = rm; + p->maxrmargin = rmax; return(0); } @@ -1681,7 +1686,7 @@ static void termp_bd_post(DECL_ARGS) { int type; - size_t sv; + size_t rm, rmax; if (MDOC_BODY != n->type) return; @@ -1689,15 +1694,17 @@ termp_bd_post(DECL_ARGS) type = arg_disptype(n->parent); assert(-1 != type); - sv = p->rmargin; + rm = p->rmargin; + rmax = p->maxrmargin; if (MDOC_Literal == type || MDOC_Unfilled == type) - p->rmargin = 100000; /* FIXME */ + p->rmargin = p->maxrmargin = TERM_MAXMARGIN; p->flags |= TERMP_NOSPACE; term_flushln(p); - p->rmargin = sv; + p->rmargin = rm; + p->maxrmargin = rmax; } @@ -1887,7 +1894,7 @@ termp_in_post(DECL_ARGS) term_word(p, ">"); term_fontpop(p); - if (SEC_SYNOPSIS != n->sec) + if (SEC_SYNOPSIS != n->sec && ! (MDOC_LINE & n->flags)) return; term_newln(p);