=================================================================== RCS file: /cvs/mandoc/tbl_term.c,v retrieving revision 1.29 retrieving revision 1.32 diff -u -p -r1.29 -r1.32 --- mandoc/tbl_term.c 2014/10/13 23:31:46 1.29 +++ mandoc/tbl_term.c 2014/12/24 15:38:55 1.32 @@ -1,4 +1,4 @@ -/* $Id: tbl_term.c,v 1.29 2014/10/13 23:31:46 schwarze Exp $ */ +/* $Id: tbl_term.c,v 1.32 2014/12/24 15:38:55 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons * Copyright (c) 2011, 2012, 2014 Ingo Schwarze @@ -91,7 +91,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp) tp->tbl.slen = term_tbl_strlen; tp->tbl.arg = tp; - tblcalc(&tp->tbl, sp); + tblcalc(&tp->tbl, sp, rmargin - tp->offset); } /* Horizontal frame at the start of boxed tables. */ @@ -107,7 +107,7 @@ term_tbl(struct termp *tp, const struct tbl_span *sp) /* Vertical frame at the start of each row. */ if ((TBL_OPT_BOX | TBL_OPT_DBOX) & sp->opts->opts || - sp->head->vert) + (sp->head != NULL && sp->head->vert)) term_word(tp, TBL_SPAN_HORIZ == sp->pos || TBL_SPAN_DHORIZ == sp->pos ? "+" : "|"); @@ -417,9 +417,13 @@ tbl_number(struct termp *tp, const struct tbl_opts *op } 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);