From: Kristaps Dzonsons Date: Sun, 15 May 2011 15:47:46 +0000 (+0000) Subject: Fix missing support for \N'n' when calculating string widths in -Tascii X-Git-Tag: VERSION_1_11_3~41 X-Git-Url: https://git.cameronkatri.com/mandoc.git/commitdiff_plain/d60df528affe8e1fa6467b843167b9697cb433ad?ds=inline Fix missing support for \N'n' when calculating string widths in -Tascii (oops). Do the same for -Thtml (oops^2). --- diff --git a/chars.c b/chars.c index 6d9cf9d3..41b02e34 100644 --- a/chars.c +++ b/chars.c @@ -1,4 +1,4 @@ -/* $Id: chars.c,v 1.41 2011/05/14 17:54:42 kristaps Exp $ */ +/* $Id: chars.c,v 1.42 2011/05/15 15:47:46 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -141,6 +141,7 @@ mchars_res2cp(struct mchars *arg, const char *p, size_t sz) * This can only be a printable character (i.e., alnum, punct, space) so * prevent the character from ruining our state (backspace, newline, and * so on). + * If the character is illegal, returns '\0'. */ char mchars_num2char(const char *p, size_t sz) diff --git a/html.c b/html.c index 8fb81c51..d6ac1a45 100644 --- a/html.c +++ b/html.c @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.138 2011/05/14 16:28:23 kristaps Exp $ */ +/* $Id: html.c,v 1.139 2011/05/15 15:47:46 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze @@ -316,9 +316,10 @@ html_strlen(const char *cp) switch (mandoc_escape(&cp, &seq, &ssz)) { case (ESCAPE_ERROR): return(sz); + case (ESCAPE_NUMBERED): + /* FALLTHROUGH */ case (ESCAPE_PREDEF): - sz++; - break; + /* FALLTHROUGH */ case (ESCAPE_SPECIAL): sz++; break; 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; }