aboutsummaryrefslogtreecommitdiffstatshomepage
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
commitd60df528affe8e1fa6467b843167b9697cb433ad (patch)
treec4a7282578a910dc3ec1f4659e78e2922e58bff9 /term.c
parentc462999d899acf87741657ed63dff7612559ce20 (diff)
downloadmandoc-d60df528affe8e1fa6467b843167b9697cb433ad.tar.gz
mandoc-d60df528affe8e1fa6467b843167b9697cb433ad.tar.zst
mandoc-d60df528affe8e1fa6467b843167b9697cb433ad.zip
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.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/term.c b/term.c
index 1c5e8ff0..110bbc46 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.189 2011/05/15 14:50:01 kristaps Exp $ */
+/* $Id: term.c,v 1.190 2011/05/15 15:47:46 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -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;
}