summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-03-23 12:42:22 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-03-23 12:42:22 +0000
commitb91ebfead4e5c9a7e1474e1ed5347724613df9d6 (patch)
tree51be4532c14e9004fcbf1431249109077d775ac0 /term.c
parent664c21875228ae7f241f792abcc521bc64e42067 (diff)
downloadmandoc-b91ebfead4e5c9a7e1474e1ed5347724613df9d6.tar.gz
Fixed two very subtle bugs in retaining overstep and maxrmargin widths between parse sequences.
Diffstat (limited to 'term.c')
-rw-r--r--term.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/term.c b/term.c
index ede55851..a80892e6 100644
--- a/term.c
+++ b/term.c
@@ -83,7 +83,6 @@ term_alloc(enum termenc enc)
perror(NULL);
exit(EXIT_FAILURE);
}
- p->maxrmargin = 78;
p->enc = enc;
return(p);
}
@@ -136,7 +135,6 @@ term_flushln(struct termp *p)
size_t bp; /* visual right border position */
int j; /* temporary loop index */
size_t maxvis, mmax;
- static int overstep = 0;
/*
* First, establish the maximum columns of "visible" content.
@@ -147,12 +145,12 @@ term_flushln(struct termp *p)
assert(p->offset < p->rmargin);
- maxvis = (int)(p->rmargin - p->offset) - overstep < 0 ?
+ maxvis = (int)(p->rmargin - p->offset) - p->overstep < 0 ?
/* LINTED */
- 0 : p->rmargin - p->offset - overstep;
- mmax = (int)(p->maxrmargin - p->offset) - overstep < 0 ?
+ 0 : p->rmargin - p->offset - p->overstep;
+ mmax = (int)(p->maxrmargin - p->offset) - p->overstep < 0 ?
/* LINTED */
- 0 : p->maxrmargin - p->offset - overstep;
+ 0 : p->maxrmargin - p->offset - p->overstep;
bp = TERMP_NOBREAK & p->flags ? mmax : maxvis;
@@ -215,10 +213,10 @@ term_flushln(struct termp *p)
putchar(' ');
vis = 0;
}
- /* Remove the overstep width. */
+ /* Remove the p->overstep width. */
bp += (int)/* LINTED */
- overstep;
- overstep = 0;
+ p->overstep;
+ p->overstep = 0;
} else {
for (j = 0; j < (int)vbl; j++)
putchar(' ');
@@ -242,7 +240,7 @@ term_flushln(struct termp *p)
}
p->col = 0;
- overstep = 0;
+ p->overstep = 0;
if ( ! (TERMP_NOBREAK & p->flags)) {
putchar('\n');
@@ -251,7 +249,7 @@ term_flushln(struct termp *p)
if (TERMP_HANG & p->flags) {
/* We need one blank after the tag. */
- overstep = /* LINTED */
+ p->overstep = /* LINTED */
vis - maxvis + 1;
/*
@@ -264,12 +262,12 @@ term_flushln(struct termp *p)
* move it one step LEFT and flag the rest of the line
* to be longer.
*/
- if (overstep >= -1) {
- assert((int)maxvis + overstep >= 0);
+ if (p->overstep >= -1) {
+ assert((int)maxvis + p->overstep >= 0);
/* LINTED */
- maxvis += overstep;
+ maxvis += p->overstep;
} else
- overstep = 0;
+ p->overstep = 0;
} else if (TERMP_DANGLE & p->flags)
return;