summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bd/Makefile9
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bd/offset-neg.in24
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bd/offset-neg.out_ascii21
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/bullet.in18
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/bullet.out_ascii14
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/dash.in18
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/dash.out_ascii14
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/enum.in22
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/enum.out_ascii17
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/hang.in47
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/hang.out_ascii38
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/offset.in10
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/offset.out_ascii6
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/tag.in38
-rw-r--r--regress/usr.bin/mandoc/mdoc/Bl/tag.out_ascii36
-rw-r--r--usr.bin/mandoc/mdoc_man.c57
-rw-r--r--usr.bin/mandoc/mdoc_term.c107
-rw-r--r--usr.bin/mandoc/term.c4
18 files changed, 403 insertions, 97 deletions
diff --git a/regress/usr.bin/mandoc/mdoc/Bd/Makefile b/regress/usr.bin/mandoc/mdoc/Bd/Makefile
index 1971ec3f0a1..817d9fe71ad 100644
--- a/regress/usr.bin/mandoc/mdoc/Bd/Makefile
+++ b/regress/usr.bin/mandoc/mdoc/Bd/Makefile
@@ -1,17 +1,18 @@
-# $OpenBSD: Makefile,v 1.17 2014/11/10 20:59:41 schwarze Exp $
+# $OpenBSD: Makefile,v 1.18 2014/12/24 23:31:59 schwarze Exp $
REGRESS_TARGETS = beforeNAME blank centered nested spacing
-REGRESS_TARGETS += badargs empty offset-empty
+REGRESS_TARGETS += badargs empty offset-empty offset-neg
REGRESS_TARGETS += break broken unclosed
LINT_TARGETS = beforeNAME blank nested badargs break broken unclosed
SKIP_TMAN = beforeNAME centered
-# groff-1.22.2 defect:
+# groff-1.22.3 defects:
# - a display breaking another block continues indefinitely
+# - negative offsets take no effect, but advance the indention on exit
-SKIP_GROFF = break
+SKIP_GROFF = break offset-neg
# adjustment is disabled in groff for now
diff --git a/regress/usr.bin/mandoc/mdoc/Bd/offset-neg.in b/regress/usr.bin/mandoc/mdoc/Bd/offset-neg.in
new file mode 100644
index 00000000000..30f0fe73217
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bd/offset-neg.in
@@ -0,0 +1,24 @@
+.Dd December 24, 2014
+.Dt BD-INDENT 1
+.Os OpenBSD
+.Sh NAME
+.Nm Bd-indent
+.Nd indenting display blocks
+.Sh DESCRIPTION
+regular text
+.Bd -ragged -offset 8n
+outer display
+.Bd -ragged -offset -5n
+inner display
+.Ed
+outer display
+.Ed
+regular text
+.Bd -ragged -offset -3n
+outer display
+.Bd -ragged -offset 8n
+inner display
+.Ed
+outer display
+.Ed
+regular text
diff --git a/regress/usr.bin/mandoc/mdoc/Bd/offset-neg.out_ascii b/regress/usr.bin/mandoc/mdoc/Bd/offset-neg.out_ascii
new file mode 100644
index 00000000000..0ecf61cf48f
--- /dev/null
+++ b/regress/usr.bin/mandoc/mdoc/Bd/offset-neg.out_ascii
@@ -0,0 +1,21 @@
+BD-INDENT(1) General Commands Manual BD-INDENT(1)
+
+NNAAMMEE
+ BBdd--iinnddeenntt - indenting display blocks
+
+DDEESSCCRRIIPPTTIIOONN
+ regular text
+
+ outer display
+
+ inner display
+ outer display
+ regular text
+
+ outer display
+
+ inner display
+ outer display
+ regular text
+
+OpenBSD December 24, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/bullet.in b/regress/usr.bin/mandoc/mdoc/Bl/bullet.in
index 13a58f338af..e189df2770b 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/bullet.in
+++ b/regress/usr.bin/mandoc/mdoc/Bl/bullet.in
@@ -1,10 +1,26 @@
-.Dd June 17, 2009
+.Dd December 25, 2014
.Dt BL-BULLET 1
.Os OpenBSD
.Sh NAME
.Nm Bl-bullet
.Nd bullet lists
.Sh DESCRIPTION
+.Bl -bullet -width -4n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -bullet -width -3n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -bullet -width -2n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -bullet -width -1n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
.Bl -bullet -width 0n
.It
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/bullet.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/bullet.out_ascii
index 8da2173be43..e188f799e08 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/bullet.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Bl/bullet.out_ascii
@@ -5,6 +5,18 @@ NNAAMMEE
DDEESSCCRRIIPPTTIIOONN
++oo x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ ++oo x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ ++oo x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ ++oo x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ ++oo x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x
++oo x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
@@ -52,4 +64,4 @@ DDEESSCCRRIIPPTTIIOONN
++oo x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x
-OpenBSD June 17, 2009 OpenBSD
+OpenBSD December 25, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/dash.in b/regress/usr.bin/mandoc/mdoc/Bl/dash.in
index 92e36821f72..37c8ad1a101 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/dash.in
+++ b/regress/usr.bin/mandoc/mdoc/Bl/dash.in
@@ -1,10 +1,26 @@
-.Dd June 17, 2009
+.Dd December 25, 2014
.Dt BL-DASH 1
.Os OpenBSD
.Sh NAME
.Nm Bl-dash
.Nd dash and hyphen lists
.Sh DESCRIPTION
+.Bl -dash -width -4n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -dash -width -3n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -dash -width -2n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -dash -width -1n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
.Bl -dash -width 0n
.It
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/dash.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/dash.out_ascii
index f2a53dc1190..f6677bee86a 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/dash.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Bl/dash.out_ascii
@@ -5,6 +5,18 @@ NNAAMMEE
DDEESSCCRRIIPPTTIIOONN
-- x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ -- x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ -- x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ -- x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ -- x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x
-- x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
@@ -52,4 +64,4 @@ DDEESSCCRRIIPPTTIIOONN
-- x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x
-OpenBSD June 17, 2009 OpenBSD
+OpenBSD December 25, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/enum.in b/regress/usr.bin/mandoc/mdoc/Bl/enum.in
index a2cc696f155..e5b1c618093 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/enum.in
+++ b/regress/usr.bin/mandoc/mdoc/Bl/enum.in
@@ -1,10 +1,30 @@
-.Dd June 17, 2009
+.Dd December 25, 2014
.Dt BL-ENUM 1
.Os OpenBSD
.Sh NAME
.Nm Bl-enum
.Nd enumerated lists
.Sh DESCRIPTION
+.Bl -enum -width -4n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -enum -width -3n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -enum -width -2n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -enum -width -1n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -enum -width 0n
+.It
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
.Bl -enum -width 1n
.It
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/enum.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/enum.out_ascii
index 71e4a7fdc96..769dc21889f 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/enum.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Bl/enum.out_ascii
@@ -5,6 +5,21 @@ NNAAMMEE
DDEESSCCRRIIPPTTIIOONN
1. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x
+
+ 1. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x
+
+ 1. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x
+
+ 1. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x
+
+ 1. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x
+
+ 1. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x
1. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
@@ -49,4 +64,4 @@ DDEESSCCRRIIPPTTIIOONN
12. x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x
-OpenBSD June 17, 2009 OpenBSD
+OpenBSD December 25, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/hang.in b/regress/usr.bin/mandoc/mdoc/Bl/hang.in
index 4b4e2d72b3d..2b2b755457f 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/hang.in
+++ b/regress/usr.bin/mandoc/mdoc/Bl/hang.in
@@ -1,10 +1,55 @@
-.Dd April 8, 2014
+.Dd December 25, 2014
.Dt BL-HANG 1
.Os OpenBSD
.Sh NAME
.Nm Bl-hang
.Nd hanged lists
.Sh DESCRIPTION
+.Bl -hang -width -4n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width -3n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width -2n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width -1n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width 0n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width 1n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width 2n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width 3n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -hang -width 4n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
.Bl -hang -width 5n
.It tag
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/hang.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/hang.out_ascii
index 1081c09a1e8..04cce936627 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/hang.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Bl/hang.out_ascii
@@ -4,6 +4,42 @@ NNAAMMEE
BBll--hhaanngg - hanged lists
DDEESSCCRRIIPPTTIIOONN
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x x x x x x x
+
tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x x x x
@@ -46,4 +82,4 @@ DDEESSCCRRIIPPTTIIOONN
tag text
-OpenBSD April 8, 2014 OpenBSD
+OpenBSD December 25, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/offset.in b/regress/usr.bin/mandoc/mdoc/Bl/offset.in
index 4e5b334fbda..9564b105ac2 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/offset.in
+++ b/regress/usr.bin/mandoc/mdoc/Bl/offset.in
@@ -1,4 +1,4 @@
-.Dd November 20, 2014
+.Dd December 25, 2014
.Dt BL-OFFSET 1
.Os OpenBSD
.Sh NAME
@@ -37,6 +37,10 @@ Bl item offset Ds
.It
Bl item offset 78n
.El
+.Bl -item -offset -3n
+.It
+Bl item offset -3n
+.El
.Bl -tag -width Ds -offset
.It tag
Bl tag width Ds offset empty
@@ -69,3 +73,7 @@ Bl tag width Ds offset Ds
.It tag
Bl tag width Ds offset 78n
.El
+.Bl -tag -width Ds -offset -3n
+.It tag
+Bl tag width Ds offset -3n
+.El
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/offset.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/offset.out_ascii
index 345b583870b..8c871d44660 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/offset.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Bl/offset.out_ascii
@@ -23,6 +23,8 @@ DDEESSCCRRIIPPTTIIOONN
offset
78n
+ Bl item offset -3n
+
tag Bl tag width Ds offset empty
tag Bl tag width Ds offset left
@@ -44,4 +46,6 @@ DDEESSCCRRIIPPTTIIOONN
offset
78n
-OpenBSD November 20, 2014 OpenBSD
+ tag Bl tag width Ds offset -3n
+
+OpenBSD December 25, 2014 OpenBSD
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/tag.in b/regress/usr.bin/mandoc/mdoc/Bl/tag.in
index 649da804535..ee2d1b46d70 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/tag.in
+++ b/regress/usr.bin/mandoc/mdoc/Bl/tag.in
@@ -1,10 +1,46 @@
-.Dd November 16, 2014
+.Dd December 25, 2014
.Dt BL-TAG 1
.Os OpenBSD
.Sh NAME
.Nm Bl-tag
.Nd tagged lists
.Sh DESCRIPTION
+.Bl -tag -width -4n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width -3n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width -2n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width -1n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width 0n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width 1n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width 2n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width 3n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
+.Bl -tag -width 4n
+.It tag
+x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+.El
.Bl -tag -width 5n
.It tag
x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
diff --git a/regress/usr.bin/mandoc/mdoc/Bl/tag.out_ascii b/regress/usr.bin/mandoc/mdoc/Bl/tag.out_ascii
index 959b1c8a4b8..a112c5b8729 100644
--- a/regress/usr.bin/mandoc/mdoc/Bl/tag.out_ascii
+++ b/regress/usr.bin/mandoc/mdoc/Bl/tag.out_ascii
@@ -4,6 +4,40 @@ NNAAMMEE
BBll--ttaagg - tagged lists
DDEESSCCRRIIPPTTIIOONN
+ tag
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x
+
+ tag
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x
+
+ tag
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x
+
+ tag
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ tag
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x
+
+ tag
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x
+
+ tag
+ x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x
+
+ tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
+ x x x x x x
+
tag x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x
@@ -77,4 +111,4 @@ DDEESSCCRRIIPPTTIIOONN
second paragraph
-OpenBSD November 16, 2014 OpenBSD
+OpenBSD December 25, 2014 OpenBSD
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index 28cede1fd0b..5f420e580b1 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_man.c,v 1.78 2014/12/23 13:48:15 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.79 2014/12/24 23:31:59 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -114,8 +114,8 @@ static void print_word(const char *);
static void print_line(const char *, int);
static void print_block(const char *, int);
static void print_offs(const char *, int);
-static void print_width(const char *,
- const struct mdoc_node *, size_t);
+static void print_width(const struct mdoc_bl *,
+ const struct mdoc_node *);
static void print_count(int *);
static void print_node(DECL_ARGS);
@@ -263,7 +263,7 @@ static int outflags;
#define BL_STACK_MAX 32
-static size_t Bl_stack[BL_STACK_MAX]; /* offsets [chars] */
+static int Bl_stack[BL_STACK_MAX]; /* offsets [chars] */
static int Bl_stack_post[BL_STACK_MAX]; /* add final .RE */
static int Bl_stack_len; /* number of nested Bl blocks */
static int TPremain; /* characters before tag is full */
@@ -421,7 +421,7 @@ print_offs(const char *v, int keywords)
{
char buf[24];
struct roffsu su;
- size_t sz;
+ int sz;
print_line(".RS", MMAN_Bk_susp);
@@ -433,8 +433,6 @@ print_offs(const char *v, int keywords)
else if (keywords && !strcmp(v, "indent-two"))
sz = 12;
else if (a2roffsu(v, &su, SCALE_EN) > 1) {
- if (su.scale < 0.0)
- su.scale = 0.0;
if (SCALE_EN == su.unit)
sz = su.scale;
else {
@@ -459,7 +457,7 @@ print_offs(const char *v, int keywords)
if (Bl_stack_len)
sz += Bl_stack[Bl_stack_len - 1];
- (void)snprintf(buf, sizeof(buf), "%zun", sz);
+ (void)snprintf(buf, sizeof(buf), "%dn", sz);
print_word(buf);
outflags |= MMAN_nl;
}
@@ -468,22 +466,19 @@ print_offs(const char *v, int keywords)
* Set up the indentation for a list item; used from pre_it().
*/
static void
-print_width(const char *v, const struct mdoc_node *child, size_t defsz)
+print_width(const struct mdoc_bl *bl, const struct mdoc_node *child)
{
char buf[24];
struct roffsu su;
- size_t sz, chsz;
- int numeric, remain;
+ int numeric, remain, sz, chsz;
numeric = 1;
remain = 0;
- /* Convert v into a number (of characters). */
- if (NULL == v)
- sz = defsz;
- else if (a2roffsu(v, &su, SCALE_MAX) > 1) {
- if (su.scale < 0.0)
- su.scale = 0.0;
+ /* Convert the width into a number (of characters). */
+ if (bl->width == NULL)
+ sz = (bl->type == LIST_hang) ? 6 : 0;
+ else if (a2roffsu(bl->width, &su, SCALE_MAX) > 1) {
if (SCALE_EN == su.unit)
sz = su.scale;
else {
@@ -491,11 +486,15 @@ print_width(const char *v, const struct mdoc_node *child, size_t defsz)
numeric = 0;
}
} else
- sz = strlen(v);
+ sz = strlen(bl->width);
/* XXX Rough estimation, might have multiple parts. */
- chsz = (NULL != child && MDOC_TEXT == child->type) ?
- strlen(child->string) : 0;
+ if (bl->type == LIST_enum)
+ chsz = (bl->count > 8) + 1;
+ else if (child != NULL && child->type == MDOC_TEXT)
+ chsz = strlen(child->string);
+ else
+ chsz = 0;
/* Maybe we are inside an enclosing list? */
mid_it();
@@ -507,17 +506,17 @@ print_width(const char *v, const struct mdoc_node *child, size_t defsz)
Bl_stack[Bl_stack_len++] = sz + 2;
/* Set up the current list. */
- if (defsz && chsz > sz)
+ if (chsz > sz && bl->type != LIST_tag)
print_block(".HP", 0);
else {
print_block(".TP", 0);
remain = sz + 2;
}
if (numeric) {
- (void)snprintf(buf, sizeof(buf), "%zun", sz + 2);
+ (void)snprintf(buf, sizeof(buf), "%dn", sz + 2);
print_word(buf);
} else
- print_word(v);
+ print_word(bl->width);
TPremain = remain;
}
@@ -526,7 +525,7 @@ print_count(int *count)
{
char buf[24];
- (void)snprintf(buf, sizeof(buf), "%d.", ++*count);
+ (void)snprintf(buf, sizeof(buf), "%d.\\&", ++*count);
print_word(buf);
}
@@ -1364,7 +1363,7 @@ pre_it(DECL_ARGS)
case LIST_dash:
/* FALLTHROUGH */
case LIST_hyphen:
- print_width(bln->norm->Bl.width, NULL, 0);
+ print_width(&bln->norm->Bl, NULL);
TPremain = 0;
outflags |= MMAN_nl;
font_push('B');
@@ -1376,19 +1375,19 @@ pre_it(DECL_ARGS)
outflags |= MMAN_nl;
return(0);
case LIST_enum:
- print_width(bln->norm->Bl.width, NULL, 0);
+ print_width(&bln->norm->Bl, NULL);
TPremain = 0;
outflags |= MMAN_nl;
print_count(&bln->norm->Bl.count);
outflags |= MMAN_nl;
return(0);
case LIST_hang:
- print_width(bln->norm->Bl.width, n->child, 6);
+ print_width(&bln->norm->Bl, n->child);
TPremain = 0;
outflags |= MMAN_nl;
return(1);
case LIST_tag:
- print_width(bln->norm->Bl.width, n->child, 0);
+ print_width(&bln->norm->Bl, n->child);
putchar('\n');
outflags &= ~MMAN_spc;
return(1);
@@ -1420,7 +1419,7 @@ mid_it(void)
/* Restore the indentation of the enclosing list. */
print_line(".RS", MMAN_Bk_susp);
- (void)snprintf(buf, sizeof(buf), "%zun",
+ (void)snprintf(buf, sizeof(buf), "%dn",
Bl_stack[Bl_stack_len - 1]);
print_word(buf);
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 902f5bdc4dc..0933dba0478 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_term.c,v 1.200 2014/12/23 13:48:15 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.201 2014/12/24 23:31:59 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -20,6 +20,7 @@
#include <assert.h>
#include <ctype.h>
+#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -47,7 +48,7 @@ struct termact {
void (*post)(DECL_ARGS);
};
-static size_t a2width(const struct termp *, const char *);
+static int a2width(const struct termp *, const char *);
static void print_bvspace(struct termp *,
const struct mdoc_node *,
@@ -523,7 +524,7 @@ print_mdoc_head(struct termp *p, const void *arg)
free(volume);
}
-static size_t
+static int
a2width(const struct termp *p, const char *v)
{
struct roffsu su;
@@ -531,9 +532,7 @@ a2width(const struct termp *p, const char *v)
if (a2roffsu(v, &su, SCALE_MAX) < 2) {
SCALE_HS_INIT(&su, term_strlen(p, v));
su.scale /= term_strlen(p, "0");
- } else if (su.scale < 0.0)
- su.scale = 0.0;
-
+ }
return(term_hspan(p, &su));
}
@@ -604,10 +603,10 @@ termp_ll_pre(DECL_ARGS)
static int
termp_it_pre(DECL_ARGS)
{
- const struct mdoc_node *bl, *nn;
char buf[24];
- int i;
- size_t width, offset, ncols, dcol;
+ const struct mdoc_node *bl, *nn;
+ size_t ncols, dcol;
+ int i, offset, width;
enum mdoc_list type;
if (MDOC_BLOCK == n->type) {
@@ -619,15 +618,46 @@ termp_it_pre(DECL_ARGS)
type = bl->norm->Bl.type;
/*
+ * Defaults for specific list types.
+ */
+
+ switch (type) {
+ case LIST_bullet:
+ /* FALLTHROUGH */
+ case LIST_dash:
+ /* FALLTHROUGH */
+ case LIST_hyphen:
+ /* FALLTHROUGH */
+ case LIST_enum:
+ width = term_len(p, 2);
+ break;
+ case LIST_hang:
+ width = term_len(p, 8);
+ break;
+ case LIST_column:
+ /* FALLTHROUGH */
+ case LIST_tag:
+ width = term_len(p, 10);
+ break;
+ default:
+ width = 0;
+ break;
+ }
+ offset = 0;
+
+ /*
* First calculate width and offset. This is pretty easy unless
* we're a -column list, in which case all prior columns must
* be accounted for.
*/
- width = offset = 0;
-
- if (bl->norm->Bl.offs)
+ if (bl->norm->Bl.offs != NULL) {
offset = a2width(p, bl->norm->Bl.offs);
+ if (offset < 0 && (size_t)(-offset) > p->offset)
+ offset = -p->offset;
+ else if (offset > SHRT_MAX)
+ offset = 0;
+ }
switch (type) {
case LIST_column:
@@ -682,39 +712,11 @@ termp_it_pre(DECL_ARGS)
* number for buffering single arguments. See the above
* handling for column for how this changes.
*/
- assert(bl->norm->Bl.width);
width = a2width(p, bl->norm->Bl.width) + term_len(p, 2);
- break;
- }
-
- /*
- * List-type can override the width in the case of fixed-head
- * values (bullet, dash/hyphen, enum). Tags need a non-zero
- * offset.
- */
-
- switch (type) {
- case LIST_bullet:
- /* FALLTHROUGH */
- case LIST_dash:
- /* FALLTHROUGH */
- case LIST_hyphen:
- /* FALLTHROUGH */
- case LIST_enum:
- if (width < term_len(p, 2))
- width = term_len(p, 2);
- break;
- case LIST_hang:
- if (0 == width)
- width = term_len(p, 8);
- break;
- case LIST_column:
- /* FALLTHROUGH */
- case LIST_tag:
- if (0 == width)
- width = term_len(p, 10);
- break;
- default:
+ if (width < 0 && (size_t)(-width) > p->offset)
+ width = -p->offset;
+ else if (width > SHRT_MAX)
+ width = 0;
break;
}
@@ -760,16 +762,16 @@ termp_it_pre(DECL_ARGS)
case LIST_enum:
/*
* Weird special case.
- * Very narrow enum lists actually hang.
+ * Some very narrow lists actually hang.
*/
- if (width == term_len(p, 2))
- p->flags |= TERMP_HANG;
/* FALLTHROUGH */
case LIST_bullet:
/* FALLTHROUGH */
case LIST_dash:
/* FALLTHROUGH */
case LIST_hyphen:
+ if (width <= (int)term_len(p, 2))
+ p->flags |= TERMP_HANG;
if (MDOC_HEAD != n->type)
break;
p->flags |= TERMP_NOBREAK;
@@ -858,7 +860,6 @@ termp_it_pre(DECL_ARGS)
case LIST_hyphen:
/* FALLTHROUGH */
case LIST_tag:
- assert(width);
if (MDOC_HEAD == n->type)
p->rmargin = p->offset + width;
else
@@ -1538,6 +1539,7 @@ termp_bd_pre(DECL_ARGS)
{
size_t tabwidth, lm, len, rm, rmax;
struct mdoc_node *nn;
+ int offset;
if (MDOC_BLOCK == n->type) {
print_bvspace(p, n, n);
@@ -1554,8 +1556,13 @@ termp_bd_pre(DECL_ARGS)
p->offset += term_len(p, p->defindent + 1);
else if ( ! strcmp(n->norm->Bd.offs, "indent-two"))
p->offset += term_len(p, (p->defindent + 1) * 2);
- else
- p->offset += a2width(p, n->norm->Bd.offs);
+ else {
+ offset = a2width(p, n->norm->Bd.offs);
+ if (offset < 0 && (size_t)(-offset) > p->offset)
+ p->offset = 0;
+ else if (offset < SHRT_MAX)
+ p->offset += offset;
+ }
/*
* If -ragged or -filled are specified, the block does nothing
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index 76836aac3ef..ee247461963 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term.c,v 1.101 2014/12/24 09:57:41 schwarze Exp $ */
+/* $OpenBSD: term.c,v 1.102 2014/12/24 23:31:59 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -271,7 +271,7 @@ term_flushln(struct termp *p)
}
if (TERMP_HANG & p->flags) {
- p->overstep = (int)(vis - maxvis +
+ p->overstep += (int)(p->offset + vis - p->rmargin +
p->trailspace * (*p->width)(p, ' '));
/*