=================================================================== RCS file: /cvs/mandoc/man_term.c,v retrieving revision 1.196 retrieving revision 1.201 diff -u -p -r1.196 -r1.201 --- mandoc/man_term.c 2017/05/05 13:17:55 1.196 +++ mandoc/man_term.c 2017/06/04 18:50:35 1.201 @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.196 2017/05/05 13:17:55 schwarze Exp $ */ +/* $Id: man_term.c,v 1.201 2017/06/04 18:50:35 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017 Ingo Schwarze @@ -68,6 +68,7 @@ static void print_bvspace(struct termp *, const struct roff_node *, int); static int pre_B(DECL_ARGS); +static int pre_DT(DECL_ARGS); static int pre_HP(DECL_ARGS); static int pre_I(DECL_ARGS); static int pre_IP(DECL_ARGS); @@ -83,7 +84,6 @@ static int pre_alternate(DECL_ARGS); static int pre_ign(DECL_ARGS); static int pre_in(DECL_ARGS); static int pre_literal(DECL_ARGS); -static int pre_sp(DECL_ARGS); static void post_IP(DECL_ARGS); static void post_HP(DECL_ARGS); @@ -114,12 +114,11 @@ static const struct termact __termacts[MAN_MAX - MAN_T { pre_I, NULL, 0 }, /* I */ { pre_alternate, NULL, 0 }, /* IR */ { pre_alternate, NULL, 0 }, /* RI */ - { pre_sp, NULL, MAN_NOTEXT }, /* sp */ { pre_literal, NULL, 0 }, /* nf */ { pre_literal, NULL, 0 }, /* fi */ { NULL, NULL, 0 }, /* RE */ { pre_RS, post_RS, 0 }, /* RS */ - { pre_ign, NULL, 0 }, /* DT */ + { pre_DT, NULL, 0 }, /* DT */ { pre_ign, NULL, MAN_NOTEXT }, /* UC */ { pre_PD, NULL, MAN_NOTEXT }, /* PD */ { pre_ign, NULL, 0 }, /* AT */ @@ -142,9 +141,10 @@ terminal_man(void *arg, const struct roff_man *man) size_t save_defindent; p = (struct termp *)arg; - p->overstep = 0; p->rmargin = p->maxrmargin = p->defrmargin; - p->tabwidth = term_len(p, 5); + term_tab_set(p, NULL); + term_tab_set(p, "T"); + term_tab_set(p, ".5i"); memset(&mt, 0, sizeof(struct mtermp)); mt.lmargin[mt.lmargincur] = term_len(p, p->defindent); @@ -392,51 +392,11 @@ pre_in(DECL_ARGS) } static int -pre_sp(DECL_ARGS) +pre_DT(DECL_ARGS) { - struct roffsu su; - int i, len; - - if ((NULL == n->prev && n->parent)) { - switch (n->parent->tok) { - case MAN_SH: - case MAN_SS: - case MAN_PP: - case MAN_LP: - case MAN_P: - return 0; - default: - break; - } - } - - if (n->child == NULL) - len = 1; - else { - if ( ! a2roffsu(n->child->string, &su, SCALE_VS)) - su.scale = 1.0; - len = term_vspan(p, &su); - } - - if (len == 0) - term_newln(p); - else if (len < 0) - p->skipvsp -= len; - else - for (i = 0; i < len; i++) - term_vspace(p); - - /* - * Handle an explicit break request in the same way - * as an overflowing line. - */ - - if (p->flags & TERMP_BRIND) { - p->offset = p->rmargin; - p->rmargin = p->maxrmargin; - p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND); - } - + term_tab_set(p, NULL); + term_tab_set(p, "T"); + term_tab_set(p, ".5i"); return 0; } @@ -912,10 +872,11 @@ print_man_node(DECL_ARGS) * If we have a space as the first character, break * before printing the line's data. */ - if ('\0' == *n->string) { + if (*n->string == '\0') { term_vspace(p); return; - } else if (' ' == *n->string && NODE_LINE & n->flags) + } else if (*n->string == ' ' && n->flags & NODE_LINE && + (p->flags & TERMP_NONEWLINE) == 0) term_newln(p); term_word(p, n->string);