]> git.cameronkatri.com Git - mandoc.git/blobdiff - term.c
Fully skip first and last line for the purpose of cmp.
[mandoc.git] / term.c
diff --git a/term.c b/term.c
index be1ffcc702401063b1693996450bfc7ac2a806e1..1641df3d8e6d478d0a6bfce309e37ee342927d85 100644 (file)
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/*     $Id: term.c,v 1.133 2010/05/12 16:01:01 kristaps Exp $ */
+/*     $Id: term.c,v 1.135 2010/05/16 01:35:37 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
  *
@@ -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 *, size_t);
 
 
 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);
 }
 
@@ -229,7 +233,7 @@ term_flushln(struct termp *p)
                for ( ; i < (int)p->col; i++)
                        if (' ' == p->buf[i])
                                break;
-                       else if (31 == p->buf[i])
+                       else if (ASCII_NBRSP == p->buf[i])
                                putchar(' ');
                        else
                                putchar(p->buf[i]);