aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
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
commitb698a1c3f7e74ec5960f935edf96b4d1ce6779e9 (patch)
tree67fe90c75c83784c0cd24cf4954560b325536149 /term.c
parent0ddf6d0157ae5120191d9ae7333b0f72da7021d1 (diff)
downloadmandoc-b698a1c3f7e74ec5960f935edf96b4d1ce6779e9.tar.gz
mandoc-b698a1c3f7e74ec5960f935edf96b4d1ce6779e9.tar.zst
mandoc-b698a1c3f7e74ec5960f935edf96b4d1ce6779e9.zip
Avoid running the "width" termp callback for each whitespace.
Diffstat (limited to 'term.c')
-rw-r--r--term.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/term.c b/term.c
index dd7aac50..d212c004 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.163 2010/07/21 20:35:03 kristaps Exp $ */
+/* $Id: term.c,v 1.164 2010/07/25 22:56:47 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -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]) {