From 41669ffe63fd5c360ab2ee4890112fd7acefdbb0 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 8 Jan 2011 17:16:48 +0000 Subject: The numerical column type centres on the *last* decimal point. --- out.c | 2 +- tbl.7 | 2 +- tbl_term.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/out.c b/out.c index 8cc80e64..5d7ba217 100644 --- a/out.c +++ b/out.c @@ -527,7 +527,7 @@ tblcalc_number(struct rofftbl *tbl, struct roffcol *col, psz = (*tbl->slen)(buf, tbl->arg); - if (NULL != (cp = strchr(str, tp->decimal))) { + if (NULL != (cp = strrchr(str, tp->decimal))) { buf[1] = '\0'; for (ssz = 0, i = 0; cp != &str[i]; i++) { buf[0] = str[i]; diff --git a/tbl.7 b/tbl.7 index 088af960..689042f8 100644 --- a/tbl.7 +++ b/tbl.7 @@ -205,7 +205,7 @@ Right-justify a literal string within its column. .It Cm l Left-justify a literal string within its column. .It Cm n -Justify a number around its decimal point. +Justify a number around its last decimal point. If the decimal point is not found on the number, it's assumed to trail the number. .It Cm s diff --git a/tbl_term.c b/tbl_term.c index c3dbaf35..6f8f87f3 100644 --- a/tbl_term.c +++ b/tbl_term.c @@ -400,7 +400,7 @@ tbl_number(struct termp *tp, const struct tbl *tbl, psz = term_strlen(tp, buf); - if (NULL != (cp = strchr(str, tbl->decimal))) { + if (NULL != (cp = strrchr(str, tbl->decimal))) { buf[1] = '\0'; for (ssz = 0, i = 0; cp != &str[i]; i++) { buf[0] = str[i]; -- cgit