-# $OpenBSD: Makefile,v 1.5 2014/12/16 23:44:16 schwarze Exp $
+# $OpenBSD: Makefile,v 1.6 2014/12/24 15:37:23 schwarze Exp $
-REGRESS_TARGETS = center fonts macro nested numbers span vert
+REGRESS_TARGETS = center fonts macro misalign nested numbers span vert
LINT_TARGETS = macro nested
-SKIP_GROFF = nested
+
+# groff-1.22.3 defect:
+# - When space is insufficient (on either side) for properly aligning
+# a number, GNU tbl(1) moves the number too much to the right,
+# overflowing the column, even if space would be sufficient without
+# left padding.
+
+# trivial difference to groff-1.22.3:
+# .TS in a table causes a blank table line in GNU tbl(1), but not in mandoc.
+
+SKIP_GROFF = misalign nested
SKIP_TMAN ?= ALL
TBL = /usr/local/bin/tbl
--- /dev/null
+.TH TBL-MISALIGN 1 "December 24, 2014" OpenBSD
+.SH NAME
+tbl-misalign \- failing alignment in tables
+.SH DESCRIPTION
+normal text
+.TS
+box tab(:);
+n, nz.
+12.34
+_
+100.0
+0.001
+_
+1000.0
+0.0001
+.TE
--- /dev/null
+TBL-MISALIGN(1) General Commands Manual TBL-MISALIGN(1)
+
+
+
+N\bNA\bAM\bME\bE
+ tbl-misalign - failing alignment in tables
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ normal text
+
+ +------+
+ |12.34 |
+ +------+
+ |100.0 |
+ |0.001 |
+ +------+
+ |1000.0 |
+ |0.0001 |
+ +------+
+
+
+OpenBSD December 24, 2014 TBL-MISALIGN(1)
-/* $OpenBSD: tbl_term.c,v 1.19 2014/10/14 18:16:57 schwarze Exp $ */
+/* $OpenBSD: tbl_term.c,v 1.20 2014/12/24 15:37:23 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
} else
d = sz + psz;
- padl = col->decimal - d;
-
- tbl_char(tp, ASCII_NBRSP, padl);
+ if (col->decimal > d && col->width > sz) {
+ padl = col->decimal - d;
+ if (padl + sz > col->width)
+ padl = col->width - sz;
+ tbl_char(tp, ASCII_NBRSP, padl);
+ } else
+ padl = 0;
tbl_word(tp, dp);
if (col->width > sz + padl)
tbl_char(tp, ASCII_NBRSP, col->width - sz - padl);