=================================================================== RCS file: /cvs/mandoc/term.c,v retrieving revision 1.107 retrieving revision 1.113 diff -u -p -r1.107 -r1.113 --- mandoc/term.c 2009/10/18 19:03:37 1.107 +++ mandoc/term.c 2009/10/26 17:05:44 1.113 @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.107 2009/10/18 19:03:37 kristaps Exp $ */ +/* $Id: term.c,v 1.113 2009/10/26 17:05:44 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -19,6 +19,7 @@ #include #include #include +#include #include "chars.h" #include "out.h" @@ -130,7 +131,7 @@ void term_flushln(struct termp *p) { int i, j; - size_t vbl, vsz, vis, maxvis, mmax, bp, os; + size_t vbl, vsz, vis, maxvis, mmax, bp; static int overstep = 0; /* @@ -143,9 +144,6 @@ term_flushln(struct termp *p) assert(p->offset < p->rmargin); assert((int)(p->rmargin - p->offset) - overstep > 0); - /* Save the overstep. */ - os = (size_t)overstep; - maxvis = /* LINTED */ p->rmargin - p->offset - overstep; mmax = /* LINTED */ @@ -153,7 +151,6 @@ term_flushln(struct termp *p) bp = TERMP_NOBREAK & p->flags ? mmax : maxvis; vis = 0; - overstep = 0; /* * If in the standard case (left-justified), then begin with our @@ -208,8 +205,9 @@ term_flushln(struct termp *p) vis = 0; } /* Remove the overstep width. */ - bp += os; - os = 0; + bp += (int)/* LINTED */ + overstep; + overstep = 0; } else { for (j = 0; j < (int)vbl; j++) putchar(' '); @@ -226,7 +224,9 @@ term_flushln(struct termp *p) } vis += vsz; } + p->col = 0; + overstep = 0; if ( ! (TERMP_NOBREAK & p->flags)) { putchar('\n'); @@ -548,14 +548,14 @@ encode(struct termp *p, char c) { if (' ' != c) { - if (p->bold) { - buffer(p, c); - buffer(p, 8); - } if (p->under) { buffer(p, '_'); buffer(p, 8); } + if (p->bold) { + buffer(p, c); + buffer(p, 8); + } } buffer(p, c); } @@ -602,18 +602,21 @@ term_hspan(const struct roffsu *su) { double r; + /* XXX: CM, IN, and PT are approximations. */ + switch (su->unit) { case (SCALE_CM): - r = (4 * su->scale) + 2; /* FIXME: double-check. */ + r = 4 * su->scale; break; case (SCALE_IN): - r = (10 * su->scale) + 2; /* FIXME: double-check. */ + /* XXX: this is an approximation. */ + r = 10 * su->scale; break; case (SCALE_PC): - r = (10 * su->scale) / 6; /* FIXME: double-check. */ + r = (10 * su->scale) / 6; break; case (SCALE_PT): - r = (10 * su->scale) / 72; /* FIXME: double-check. */ + r = (10 * su->scale) / 72; break; case (SCALE_MM): r = su->scale / 1000; /* FIXME: double-check. */