]> git.cameronkatri.com Git - mandoc.git/blobdiff - term.c
Without HAVE_ERR, don't try to include <err.h>, it probably isn't there.
[mandoc.git] / term.c
diff --git a/term.c b/term.c
index 8701e5be16da0e6bfc728fcf7f7e007b7e8929e5..493d8770b137cb13739940b718d00f9a029d2d79 100644 (file)
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/*     $Id: term.c,v 1.251 2015/09/26 00:54:04 schwarze Exp $ */
+/*     $Id: term.c,v 1.255 2015/10/23 14:50:58 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -454,12 +454,11 @@ term_word(struct termp *p, const char *word)
                        break;
                case ESCAPE_SPECIAL:
                        if (p->enc == TERMENC_ASCII) {
                        break;
                case ESCAPE_SPECIAL:
                        if (p->enc == TERMENC_ASCII) {
-                               cp = mchars_spec2str(p->symtab,
-                                   seq, sz, &ssz);
+                               cp = mchars_spec2str(seq, sz, &ssz);
                                if (cp != NULL)
                                        encode(p, cp, ssz);
                        } else {
                                if (cp != NULL)
                                        encode(p, cp, ssz);
                        } else {
-                               uc = mchars_spec2cp(p->symtab, seq, sz);
+                               uc = mchars_spec2cp(seq, sz);
                                if (uc > 0)
                                        encode1(p, uc);
                        }
                                if (uc > 0)
                                        encode1(p, uc);
                        }
@@ -474,7 +473,6 @@ term_word(struct termp *p, const char *word)
                        term_fontrepl(p, TERMFONT_BI);
                        continue;
                case ESCAPE_FONT:
                        term_fontrepl(p, TERMFONT_BI);
                        continue;
                case ESCAPE_FONT:
-                       /* FALLTHROUGH */
                case ESCAPE_FONTROMAN:
                        term_fontrepl(p, TERMFONT_NONE);
                        continue;
                case ESCAPE_FONTROMAN:
                        term_fontrepl(p, TERMFONT_NONE);
                        continue;
@@ -566,7 +564,7 @@ encode1(struct termp *p, int c)
        if (p->col + 7 >= p->maxcols)
                adjbuf(p, p->col + 7);
 
        if (p->col + 7 >= p->maxcols)
                adjbuf(p, p->col + 7);
 
-       f = (c == ASCII_HYPH || isgraph(c)) ?
+       f = (c == ASCII_HYPH || c > 127 || isgraph(c)) ?
            p->fontq[p->fonti] : TERMFONT_NONE;
 
        if (p->flags & TERMP_BACKBEFORE) {
            p->fontq[p->fonti] : TERMFONT_NONE;
 
        if (p->flags & TERMP_BACKBEFORE) {
@@ -644,7 +642,7 @@ size_t
 term_len(const struct termp *p, size_t sz)
 {
 
 term_len(const struct termp *p, size_t sz)
 {
 
-       return((*p->width)(p, ' ') * sz);
+       return (*p->width)(p, ' ') * sz;
 }
 
 static size_t
 }
 
 static size_t
@@ -653,9 +651,9 @@ cond_width(const struct termp *p, int c, int *skip)
 
        if (*skip) {
                (*skip) = 0;
 
        if (*skip) {
                (*skip) = 0;
-               return(0);
+               return 0;
        } else
        } else
-               return((*p->width)(p, c));
+               return (*p->width)(p, c);
 }
 
 size_t
 }
 
 size_t
@@ -701,13 +699,11 @@ term_strlen(const struct termp *p, const char *cp)
                                break;
                        case ESCAPE_SPECIAL:
                                if (p->enc == TERMENC_ASCII) {
                                break;
                        case ESCAPE_SPECIAL:
                                if (p->enc == TERMENC_ASCII) {
-                                       rhs = mchars_spec2str(p->symtab,
-                                           seq, ssz, &rsz);
+                                       rhs = mchars_spec2str(seq, ssz, &rsz);
                                        if (rhs != NULL)
                                                break;
                                } else {
                                        if (rhs != NULL)
                                                break;
                                } else {
-                                       uc = mchars_spec2cp(p->symtab,
-                                           seq, ssz);
+                                       uc = mchars_spec2cp(seq, ssz);
                                        if (uc > 0)
                                                sz += cond_width(p, uc, &skip);
                                }
                                        if (uc > 0)
                                                sz += cond_width(p, uc, &skip);
                                }
@@ -771,15 +767,13 @@ term_strlen(const struct termp *p, const char *cp)
                case ASCII_HYPH:
                        sz += cond_width(p, '-', &skip);
                        cp++;
                case ASCII_HYPH:
                        sz += cond_width(p, '-', &skip);
                        cp++;
-                       /* FALLTHROUGH */
-               case ASCII_BREAK:
                        break;
                default:
                        break;
                }
        }
 
                        break;
                default:
                        break;
                }
        }
 
-       return(sz);
+       return sz;
 }
 
 int
 }
 
 int
@@ -811,7 +805,6 @@ term_vspan(const struct termp *p, const struct roffsu *su)
                r = su->scale / 12.0;
                break;
        case SCALE_EN:
                r = su->scale / 12.0;
                break;
        case SCALE_EN:
-               /* FALLTHROUGH */
        case SCALE_EM:
                r = su->scale * 0.6;
                break;
        case SCALE_EM:
                r = su->scale * 0.6;
                break;
@@ -822,7 +815,7 @@ term_vspan(const struct termp *p, const struct roffsu *su)
                abort();
        }
        ri = r > 0.0 ? r + 0.4995 : r - 0.4995;
                abort();
        }
        ri = r > 0.0 ? r + 0.4995 : r - 0.4995;
-       return(ri < 66 ? ri : 1);
+       return ri < 66 ? ri : 1;
 }
 
 /*
 }
 
 /*
@@ -832,5 +825,5 @@ int
 term_hspan(const struct termp *p, const struct roffsu *su)
 {
 
 term_hspan(const struct termp *p, const struct roffsu *su)
 {
 
-       return((*p->hspan)(p, su));
+       return (*p->hspan)(p, su);
 }
 }