X-Git-Url: https://git.cameronkatri.com/mandoc.git/blobdiff_plain/4dc1b5414a1d1531b0c9a1b0061792b0076e329a..d60df528affe8e1fa6467b843167b9697cb433ad:/term.c?ds=sidebyside 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 * Copyright (c) 2010, 2011 Ingo Schwarze @@ -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; }