From ba712caff7d1aa6bfad5031d345326df32dc101c Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 25 Jul 2010 22:56:47 +0000 Subject: Avoid running the "width" termp callback for each whitespace. --- term.c | 6 +++--- 1 file 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]) { -- cgit