From: schwarze Date: Sun, 19 Apr 2015 19:43:50 +0000 (+0000) Subject: If an explicit line break request (.br or .sp) occurs within an .HP block, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5ce49a8e00011c89142566c2ee302e2066a989e1;p=openbsd If an explicit line break request (.br or .sp) occurs within an .HP block, the next line doesn't hang, but is simply indented. Issue found by Christian Neukirchen in the dmsetup(8) manual on Linux. This patch also improves the indentation of XDGA(3) and XrmGetResource(3). --- diff --git a/regress/usr.bin/mandoc/man/HP/spacing.in b/regress/usr.bin/mandoc/man/HP/spacing.in index 485fae9a97f..0faec1b599f 100644 --- a/regress/usr.bin/mandoc/man/HP/spacing.in +++ b/regress/usr.bin/mandoc/man/HP/spacing.in @@ -6,30 +6,52 @@ Normal text. .HP Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. +.sp 1v +Vertical spacing an a third line. +.br +A fourth line. .HP -10n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP -4n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP 0n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP 1n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP 2n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP 4n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP 8n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP 16n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +.br +And a second line. .HP 78n Each hanged paragraph gets a sufficient amount of text to wrap to the next line. diff --git a/regress/usr.bin/mandoc/man/HP/spacing.out_ascii b/regress/usr.bin/mandoc/man/HP/spacing.out_ascii index 7697cffcfea..a2233044dda 100644 --- a/regress/usr.bin/mandoc/man/HP/spacing.out_ascii +++ b/regress/usr.bin/mandoc/man/HP/spacing.out_ascii @@ -10,30 +10,42 @@ DDEESSCCRRIIPPTTIIOONN Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. + + Vertical spacing an a third line. + A fourth line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. +And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next line. + And a second line. Each hanged paragraph gets a sufficient amount of text to wrap to the next diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 46547750118..028a92dcea2 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.135 2015/04/19 13:59:37 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.136 2015/04/19 19:43:50 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -480,6 +480,17 @@ pre_sp(DECL_ARGS) 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); + } + return(0); }