=================================================================== RCS file: /cvs/mandoc/man_term.c,v retrieving revision 1.188 retrieving revision 1.192 diff -u -p -r1.188 -r1.192 --- mandoc/man_term.c 2017/01/10 13:47:00 1.188 +++ mandoc/man_term.c 2017/04/24 23:06:18 1.192 @@ -1,7 +1,7 @@ -/* $Id: man_term.c,v 1.188 2017/01/10 13:47:00 schwarze Exp $ */ +/* $Id: man_term.c,v 1.192 2017/04/24 23:06:18 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010-2015 Ingo Schwarze + * Copyright (c) 2010-2015, 2017 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -95,8 +95,7 @@ static void post_SS(DECL_ARGS); static void post_TP(DECL_ARGS); static void post_UR(DECL_ARGS); -static const struct termact termacts[MAN_MAX] = { - { pre_sp, NULL, MAN_NOTEXT }, /* br */ +static const struct termact __termacts[MAN_MAX - MAN_TH] = { { NULL, NULL, 0 }, /* TH */ { pre_SH, post_SH, 0 }, /* SH */ { pre_SS, post_SS, 0 }, /* SS */ @@ -117,6 +116,7 @@ static const struct termact termacts[MAN_MAX] = { { pre_I, NULL, 0 }, /* I */ { pre_alternate, NULL, 0 }, /* IR */ { pre_alternate, NULL, 0 }, /* RI */ + { pre_sp, NULL, MAN_NOTEXT }, /* br */ { pre_sp, NULL, MAN_NOTEXT }, /* sp */ { pre_literal, NULL, 0 }, /* nf */ { pre_literal, NULL, 0 }, /* fi */ @@ -135,6 +135,7 @@ static const struct termact termacts[MAN_MAX] = { { NULL, NULL, 0 }, /* UE */ { pre_ll, NULL, MAN_NOTEXT }, /* ll */ }; +static const struct termact *termacts = __termacts - MAN_TH; void @@ -143,6 +144,7 @@ terminal_man(void *arg, const struct roff_man *man) struct termp *p; struct roff_node *n; struct mtermp mt; + size_t save_defindent; p = (struct termp *)arg; p->overstep = 0; @@ -170,6 +172,7 @@ terminal_man(void *arg, const struct roff_man *man) n = n->next; } } else { + save_defindent = p->defindent; if (p->defindent == 0) p->defindent = 7; term_begin(p, print_man_head, print_man_foot, &man->meta); @@ -177,6 +180,7 @@ terminal_man(void *arg, const struct roff_man *man) if (n != NULL) print_man_nodelist(p, &mt, n, &man->meta); term_end(p); + p->defindent = save_defindent; } } @@ -819,7 +823,8 @@ pre_SH(DECL_ARGS) do { n = n->prev; - } while (n != NULL && termacts[n->tok].flags & MAN_NOTEXT); + } while (n != NULL && n->tok != TOKEN_NONE && + termacts[n->tok].flags & MAN_NOTEXT); if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL)) break;