From f6afdd36c98a68434281551607b2563bc979f54c Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 23 Sep 2010 20:26:00 +0000 Subject: Count trailing escaped blanks correctly; those ruined the alignment of columns. Tested by jmc@, and kristaps@ agrees with the direction. --- term.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/term.c b/term.c index 71ab3a35..b609b0e8 100644 --- a/term.c +++ b/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.171 2010/09/15 14:36:16 kristaps Exp $ */ +/* $Id: term.c,v 1.172 2010/09/23 20:26:00 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -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; } -- cgit v1.2.3-56-ge451