aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'term.c')
-rw-r--r--term.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/term.c b/term.c
index c2bcd158..79a0f45f 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.168 2010/08/20 23:22:09 schwarze Exp $ */
+/* $Id: term.c,v 1.169 2010/08/20 23:34:02 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -169,12 +169,11 @@ term_flushln(struct termp *p)
* Handle literal tab characters: collapse all
* subsequent tabs into a single huge set of spaces.
*/
- for (j = i; j < (int)p->col; j++) {
- if ('\t' != p->buf[j])
- break;
+ while (i < (int)p->col && '\t' == p->buf[i]) {
vend = (vis / p->tabwidth + 1) * p->tabwidth;
vbl += vend - vis;
vis = vend;
+ i++;
}
/*
@@ -185,7 +184,7 @@ term_flushln(struct termp *p)
*/
/* LINTED */
- for (jhy = 0; j < (int)p->col; j++) {
+ for (j = i, jhy = 0; j < (int)p->col; j++) {
if ((j && ' ' == p->buf[j]) || '\t' == p->buf[j])
break;
@@ -228,12 +227,6 @@ term_flushln(struct termp *p)
p->overstep = 0;
}
- /*
- * Skip leading tabs, they were handled above.
- */
- while (i < (int)p->col && '\t' == p->buf[i])
- i++;
-
/* Write out the [remaining] word. */
for ( ; i < (int)p->col; i++) {
if (vend > bp && jhy > 0 && i > jhy)