diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2011-01-25 12:07:30 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2011-01-25 12:07:30 +0000 |
commit | 9b509b028c7418fa035a3af3c5f783a61f4abf33 (patch) | |
tree | c5ae92857c359331576fd2ae728ebc21b2b7c455 /tbl_term.c | |
parent | 026fcc9f0bcdb3ef7c2a64feae925b2fcd9c6d16 (diff) | |
download | mandoc-9b509b028c7418fa035a3af3c5f783a61f4abf33.tar.gz mandoc-9b509b028c7418fa035a3af3c5f783a61f4abf33.tar.zst mandoc-9b509b028c7418fa035a3af3c5f783a61f4abf33.zip |
correct horizontal spacing of data cells
correct alignment of centered cells
adjust horizontal rule width to the new spacing
ok kristaps@
Diffstat (limited to 'tbl_term.c')
-rw-r--r-- | tbl_term.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -1,6 +1,7 @@ -/* $Id: tbl_term.c,v 1.18 2011/01/11 14:12:01 kristaps Exp $ */ +/* $Id: tbl_term.c,v 1.19 2011/01/25 12:07:30 schwarze Exp $ */ /* - * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> + * 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 @@ -197,6 +198,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): @@ -371,11 +374,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); @@ -387,7 +390,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 |