summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2010-09-23 20:22:32 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2010-09-23 20:22:32 +0000
commitd333faff4e82e328c07ed7b1976ad45d1b6d2acc (patch)
treedb63c1cf60d808011fa709daecb74e02cc8fd173 /usr.bin/mandoc
parent9ff36f69287b4f1cb69cdef4cdf36fd543a8d0d9 (diff)
Count trailing escaped blanks correctly;
those ruined the alignment of columns. Tested by jmc@, and kristaps@ agrees with the direction.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/term.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c
index c0a8918184a..45425eadd4c 100644
--- a/usr.bin/mandoc/term.c
+++ b/usr.bin/mandoc/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.50 2010/09/21 22:33:41 schwarze Exp $ */
+/* $Id: term.c,v 1.51 2010/09/23 20:22:31 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -130,6 +130,7 @@ term_flushln(struct termp *p)
size_t vbl; /* number of blanks to prepend to output */
size_t vend; /* end of word visual position on output */
size_t bp; /* visual right border position */
+ size_t dv; /* temporary for visual pos calculations */
int j; /* temporary loop index for p->buf */
int jhy; /* last hyph before overflow w/r/t j */
size_t maxvis; /* output position of visible boundary */
@@ -233,7 +234,9 @@ term_flushln(struct termp *p)
j = i;
while (' ' == p->buf[i])
i++;
- vbl += (i - j) * (*p->width)(p, ' ');
+ dv = (i - j) * (*p->width)(p, ' ');
+ vbl += dv;
+ vend += dv;
break;
}
if (ASCII_NBRSP == p->buf[i]) {
@@ -260,7 +263,6 @@ term_flushln(struct termp *p)
p->viscol += (*p->width)(p, p->buf[i]);
}
}
- vend += vbl;
vis = vend;
}