summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-25 22:56:47 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-25 22:56:47 +0000
commitba712caff7d1aa6bfad5031d345326df32dc101c (patch)
tree3aa8237d8ea02eabc55bc646de61e6e8dc936e0a
parentc32c9b54af798951d53f0b265d9827723c718ced (diff)
downloadmandoc-ba712caff7d1aa6bfad5031d345326df32dc101c.tar.gz
Avoid running the "width" termp callback for each whitespace.
-rw-r--r--term.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/term.c b/term.c
index 4338559b..8af60c41 100644
--- a/term.c
+++ b/term.c
@@ -242,10 +242,10 @@ term_flushln(struct termp *p)
if ('\t' == p->buf[i])
break;
if (' ' == p->buf[i]) {
- while (' ' == p->buf[i]) {
- vbl += (*p->width)(p, p->buf[i]);
+ j = i;
+ while (' ' == p->buf[i])
i++;
- }
+ vbl += (i - j) * (*p->width)(p, ' ');
break;
}
if (ASCII_NBRSP == p->buf[i]) {