diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-04-19 19:43:51 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-04-19 19:43:51 +0000 |
commit | a080309ff2b4b8a5104888fb7e45b16342525280 (patch) | |
tree | e371ae770abf139bae58e7f36777ddef1ab33ab6 | |
parent | 2ff03a9c2f5efc72fc814b049f8c5a51599ea4fd (diff) |
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 <chneukirchen at gmail dot com>
in the dmsetup(8) manual on Linux.
This patch also improves the indentation of XDGA(3) and XrmGetResource(3).
-rw-r--r-- | regress/usr.bin/mandoc/man/HP/spacing.in | 22 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/man/HP/spacing.out_ascii | 12 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 13 |
3 files changed, 46 insertions, 1 deletions
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 <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -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); } |