summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2010-09-23 20:26:00 +0000
committerIngo Schwarze <schwarze@openbsd.org>2010-09-23 20:26:00 +0000
commitea12b114dd971f59e297b5fe17e30363a0e57aa9 (patch)
treec0c93f02d4588bae1aaa01a691259e9092d3965a /term.c
parente1cb38d3b9b4a4a81eb7fc5e683dd36e6ab314a9 (diff)
downloadmandoc-ea12b114dd971f59e297b5fe17e30363a0e57aa9.tar.gz
Count trailing escaped blanks correctly;
those ruined the alignment of columns. Tested by jmc@, and kristaps@ agrees with the direction.
Diffstat (limited to 'term.c')
-rw-r--r--term.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/term.c b/term.c
index afd809e7..478a6364 100644
--- a/term.c
+++ b/term.c
@@ -134,6 +134,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 */
@@ -237,7 +238,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]) {
@@ -264,7 +267,6 @@ term_flushln(struct termp *p)
p->viscol += (*p->width)(p, p->buf[i]);
}
}
- vend += vbl;
vis = vend;
}