=================================================================== RCS file: /cvs/mandoc/term.c,v retrieving revision 1.103 retrieving revision 1.105 diff -u -p -r1.103 -r1.105 --- mandoc/term.c 2009/09/23 11:02:21 1.103 +++ mandoc/term.c 2009/10/13 10:57:25 1.105 @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.103 2009/09/23 11:02:21 kristaps Exp $ */ +/* $Id: term.c,v 1.105 2009/10/13 10:57:25 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -24,15 +24,11 @@ #include "term.h" #include "man.h" #include "mdoc.h" +#include "main.h" /* FIXME: accomodate non-breaking, non-collapsing white-space. */ /* FIXME: accomodate non-breaking, collapsing white-space. */ -extern void man_run(struct termp *, - const struct man *); -extern void mdoc_run(struct termp *, - const struct mdoc *); - static struct termp *term_alloc(enum termenc); static void term_free(struct termp *); @@ -54,32 +50,6 @@ ascii_alloc(void) void -terminal_man(void *arg, const struct man *man) -{ - struct termp *p; - - p = (struct termp *)arg; - if (NULL == p->symtab) - p->symtab = chars_init(CHARS_ASCII); - - man_run(p, man); -} - - -void -terminal_mdoc(void *arg, const struct mdoc *mdoc) -{ - struct termp *p; - - p = (struct termp *)arg; - if (NULL == p->symtab) - p->symtab = chars_init(CHARS_ASCII); - - mdoc_run(p, mdoc); -} - - -void terminal_free(void *arg) { @@ -159,7 +129,7 @@ void term_flushln(struct termp *p) { int i, j; - size_t vbl, vsz, vis, maxvis, mmax, bp; + size_t vbl, vsz, vis, maxvis, mmax, bp, os; static int overstep = 0; /* @@ -172,6 +142,9 @@ 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 */ @@ -233,6 +206,9 @@ term_flushln(struct termp *p) putchar(' '); vis = 0; } + /* Remove the overstep width. */ + bp += os; + os = 0; } else { for (j = 0; j < (int)vbl; j++) putchar(' ');