diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-01-25 12:07:27 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2011-01-25 12:07:27 +0000 |
commit | 84ea6721b6b51f5fd554e8a924acbd4154b12da1 (patch) | |
tree | dee403d1d5b97b498b49070bc07a6b384341e17a /usr.bin/mandoc/tbl_term.c | |
parent | b76a97c8d4638445883f6c23ea0697db80e022f2 (diff) |
correct horizontal spacing of data cells
correct alignment of centered cells
adjust horizontal rule width to the new spacing
ok kristaps@
Diffstat (limited to 'usr.bin/mandoc/tbl_term.c')
-rw-r--r-- | usr.bin/mandoc/tbl_term.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/mandoc/tbl_term.c b/usr.bin/mandoc/tbl_term.c index 53556e5ff24..c481e50fe60 100644 --- a/usr.bin/mandoc/tbl_term.c +++ b/usr.bin/mandoc/tbl_term.c @@ -1,6 +1,7 @@ -/* $Id: tbl_term.c,v 1.7 2011/01/16 01:11:50 schwarze Exp $ */ +/* $Id: tbl_term.c,v 1.8 2011/01/25 12:07:26 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@kth.se> + * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -193,6 +194,8 @@ tbl_hrule(struct termp *tp, const struct tbl_span *sp) width = tp->tbl.cols[hp->ident].width; switch (hp->pos) { case (TBL_HEAD_DATA): + if (hp->next) + width += 2; tbl_char(tp, c, width); break; case (TBL_HEAD_DVERT): @@ -367,11 +370,11 @@ tbl_literal(struct termp *tp, const struct tbl_dat *dp, padr = col->width - term_strlen(tp, dp->string) - ssz; break; case (TBL_CELL_CENTRE): - padl = col->width - term_strlen(tp, dp->string); - if (padl % 2) - padr++; - padl /= 2; - padr += padl; + padr = col->width - term_strlen(tp, dp->string); + if (3 > padr) + break; + padl = (padr - 1) / 2; + padr -= padl; break; case (TBL_CELL_RIGHT): padl = col->width - term_strlen(tp, dp->string); @@ -383,7 +386,7 @@ tbl_literal(struct termp *tp, const struct tbl_dat *dp, tbl_char(tp, ASCII_NBRSP, padl); term_word(tp, dp->string); - tbl_char(tp, ASCII_NBRSP, padr); + tbl_char(tp, ASCII_NBRSP, padr + 2); } static void |