summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-01-25 12:07:30 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-01-25 12:07:30 +0000
commit85cfe8e76ee75394eb9ad586bebf1ba8904c4f9b (patch)
tree27d8d33a76366732b5a04d7d4f245825ccd9c5f5
parent3349c72d72c8acc21ae7930af2eb590dbe4617a0 (diff)
downloadmandoc-85cfe8e76ee75394eb9ad586bebf1ba8904c4f9b.tar.gz
correct horizontal spacing of data cells
correct alignment of centered cells adjust horizontal rule width to the new spacing ok kristaps@
-rw-r--r--out.c4
-rw-r--r--tbl_term.c17
2 files changed, 12 insertions, 9 deletions
diff --git a/out.c b/out.c
index ad16015e..d76a9702 100644
--- a/out.c
+++ b/out.c
@@ -1,6 +1,6 @@
/* $Id$ */
/*
- * Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -485,7 +485,7 @@ tblcalc_literal(struct rofftbl *tbl, struct roffcol *col,
case (TBL_CELL_LONG):
/* FALLTHROUGH */
case (TBL_CELL_CENTRE):
- bufsz = (*tbl->len)(2, tbl->arg);
+ bufsz = (*tbl->len)(1, tbl->arg);
break;
default:
bufsz = (*tbl->len)(1, tbl->arg);
diff --git a/tbl_term.c b/tbl_term.c
index dc6ff8d9..9d54d2c0 100644
--- a/tbl_term.c
+++ b/tbl_term.c
@@ -1,6 +1,7 @@
/* $Id$ */
/*
- * 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