aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--main.c4
-rw-r--r--main.h4
-rw-r--r--man_term.c10
-rw-r--r--mdoc_term.c4
-rw-r--r--term.c14
-rw-r--r--term.h3
6 files changed, 24 insertions, 15 deletions
diff --git a/main.c b/main.c
index b0539936..98c514cc 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.68 2010/05/15 09:46:31 joerg Exp $ */
+/* $Id: main.c,v 1.69 2010/05/15 16:18:23 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -484,7 +484,7 @@ fdesc(struct curparse *curp)
case (OUTT_LINT):
break;
default:
- curp->outdata = ascii_alloc();
+ curp->outdata = ascii_alloc(80);
curp->outman = terminal_man;
curp->outmdoc = terminal_mdoc;
curp->outfree = terminal_free;
diff --git a/main.h b/main.h
index 1ff1b6d2..c011cc85 100644
--- a/main.h
+++ b/main.h
@@ -1,4 +1,4 @@
-/* $Id: main.h,v 1.2 2010/01/29 14:39:38 kristaps Exp $ */
+/* $Id: main.h,v 1.3 2010/05/15 16:18:23 joerg Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -38,7 +38,7 @@ void html_free(void *);
void tree_mdoc(void *, const struct mdoc *);
void tree_man(void *, const struct man *);
-void *ascii_alloc(void);
+void *ascii_alloc(size_t);
void terminal_mdoc(void *, const struct mdoc *);
void terminal_man(void *, const struct man *);
void terminal_free(void *);
diff --git a/man_term.c b/man_term.c
index 5da984aa..a31c8d74 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.64 2010/05/15 15:54:39 kristaps Exp $ */
+/* $Id: man_term.c,v 1.65 2010/05/15 16:18:23 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -163,7 +163,7 @@ terminal_man(void *arg, const struct man *man)
p = (struct termp *)arg;
p->overstep = 0;
- p->maxrmargin = 65;
+ p->maxrmargin = p->defrmargin;
if (NULL == p->symtab)
switch (p->enc) {
@@ -803,6 +803,7 @@ post_RS(DECL_ARGS)
static void
print_man_node(DECL_ARGS)
{
+ size_t rm, rmax;
int c;
c = 1;
@@ -819,10 +820,13 @@ print_man_node(DECL_ARGS)
/* FIXME: this means that macro lines are munged! */
if (MANT_LITERAL & mt->fl) {
+ rm = p->rmargin;
+ rmax = p->maxrmargin;
p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
p->flags |= TERMP_NOSPACE;
term_flushln(p);
- p->rmargin = p->maxrmargin = 65;
+ p->rmargin = rm;
+ p->maxrmargin = rmax;
}
break;
default:
diff --git a/mdoc_term.c b/mdoc_term.c
index 728bdc28..b3485ce0 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.122 2010/05/13 06:22:11 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.123 2010/05/15 16:18:23 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -273,7 +273,7 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
p = (struct termp *)arg;
p->overstep = 0;
- p->maxrmargin = 78;
+ p->maxrmargin = p->defrmargin;
if (NULL == p->symtab)
switch (p->enc) {
diff --git a/term.c b/term.c
index be1ffcc7..e43d9692 100644
--- 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.134 2010/05/15 16:18:23 joerg 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);
}
diff --git a/term.h b/term.h
index 3b9beb01..cac23d9b 100644
--- a/term.h
+++ b/term.h
@@ -1,4 +1,4 @@
-/* $Id: term.h,v 1.54 2010/05/12 16:01:01 kristaps Exp $ */
+/* $Id: term.h,v 1.55 2010/05/15 16:18:23 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -32,6 +32,7 @@ enum termfont {
#define TERM_MAXMARGIN 100000 /* FIXME */
struct termp {
+ size_t defrmargin; /* Right margin of the device.. */
size_t rmargin; /* Current right margin. */
size_t maxrmargin; /* Max right margin. */
size_t maxcols; /* Max size of buf. */