From bbf2e5b44d2836d001e4dc02087421dbc5cb0c04 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 4 Sep 2015 21:25:00 +0000 Subject: Fill mode changes don't break next-line scope in all cases, in particular not for tagged paragraphs. Issue found by Christian Neukirchen in the exiv2(1) manual page. --- man.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'man.c') diff --git a/man.c b/man.c index 191afdd5..f231f9b6 100644 --- a/man.c +++ b/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.163 2015/04/23 16:17:44 schwarze Exp $ */ +/* $Id: man.c,v 1.164 2015/09/04 21:25:00 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -282,6 +282,20 @@ man_breakscope(struct roff_man *man, int tok) man->flags &= ~MAN_ELINE; } + /* + * Weird special case: + * Switching fill mode closes section headers. + */ + + if (man->flags & MAN_BLINE && + (tok == MAN_nf || tok == MAN_fi) && + (man->last->tok == MAN_SH || man->last->tok == MAN_SS)) { + n = man->last; + man_unscope(man, n); + roff_body_alloc(man, n->line, n->pos, n->tok); + man->flags &= ~MAN_BLINE; + } + /* * A block header next line scope is open, * and the new macro is not allowed inside block headers. -- cgit v1.2.3-56-ge451