=================================================================== RCS file: /cvs/mandoc/term.c,v retrieving revision 1.132 retrieving revision 1.134 diff -u -p -r1.132 -r1.134 --- mandoc/term.c 2010/05/07 04:50:44 1.132 +++ mandoc/term.c 2010/05/15 16:18:23 1.134 @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.132 2010/05/07 04:50:44 kristaps Exp $ */ +/* $Id: term.c,v 1.134 2010/05/15 16:18:23 joerg Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -34,7 +34,7 @@ #include "mdoc.h" #include "main.h" -static struct termp *term_alloc(enum termenc); +static struct termp *term_alloc(enum termenc, size_t); static void term_free(struct termp *); static void spec(struct termp *, const char *, size_t); static void res(struct termp *, const char *, size_t); @@ -45,10 +45,10 @@ static void encode(struct termp *, const char *, si void * -ascii_alloc(void) +ascii_alloc(size_t width) { - return(term_alloc(TERMENC_ASCII)); + return(term_alloc(TERMENC_ASCII, width)); } @@ -74,7 +74,7 @@ term_free(struct termp *p) static struct termp * -term_alloc(enum termenc enc) +term_alloc(enum termenc enc, size_t width) { struct termp *p; @@ -84,6 +84,10 @@ term_alloc(enum termenc enc) exit(EXIT_FAILURE); } p->enc = enc; + /* Enforce some lower boundary. */ + if (width < 60) + width = 60; + p->defrmargin = width - 2; return(p); } @@ -445,11 +449,16 @@ term_word(struct termp *p, const char *word) break; } - if ( ! (TERMP_NOSPACE & p->flags)) + if ( ! (TERMP_NOSPACE & p->flags)) { bufferc(p, ' '); + if (TERMP_SENTENCE & p->flags) + bufferc(p, ' '); + } if ( ! (p->flags & TERMP_NONOSPACE)) p->flags &= ~TERMP_NOSPACE; + + p->flags &= ~TERMP_SENTENCE; /* FIXME: use strcspn. */