summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-05-15 15:47:46 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-05-15 15:47:46 +0000
commitde205044ce0e8b0414ab85bbd5e600391fe34e98 (patch)
treec8ac103de72d9177c7408747b5fee48d708a206a /term.c
parent877bef0b9533150581c911aff80cfbb71c13de8e (diff)
downloadmandoc-de205044ce0e8b0414ab85bbd5e600391fe34e98.tar.gz
Fix missing support for \N'n' when calculating string widths in -Tascii
(oops). Do the same for -Thtml (oops^2).
Diffstat (limited to 'term.c')
-rw-r--r--term.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/term.c b/term.c
index 7f21d8b7..66b78ed4 100644
--- a/term.c
+++ b/term.c
@@ -605,7 +605,7 @@ size_t
term_strlen(const struct termp *p, const char *cp)
{
size_t sz, rsz, i;
- int ssz;
+ int ssz, c;
const char *seq, *rhs;
static const char rej[] = { '\\', ASCII_HYPH, ASCII_NBRSP, '\0' };
@@ -624,9 +624,15 @@ term_strlen(const struct termp *p, const char *cp)
switch (*cp) {
case ('\\'):
cp++;
+ rhs = NULL;
switch (mandoc_escape(&cp, &seq, &ssz)) {
case (ESCAPE_ERROR):
return(sz);
+ case (ESCAPE_NUMBERED):
+ c = mchars_num2char(seq, ssz);
+ if ('\0' != c)
+ sz += (*p->width)(p, c);
+ break;
case (ESCAPE_PREDEF):
rhs = mchars_res2str
(p->symtab, seq, ssz, &rsz);
@@ -642,7 +648,6 @@ term_strlen(const struct termp *p, const char *cp)
rsz = ssz;
break;
default:
- rhs = NULL;
break;
}