version 1.204, 2012/07/10 15:35:41 |
version 1.205, 2012/07/16 21:30:42 |
|
|
term_flushln(struct termp *p) |
term_flushln(struct termp *p) |
{ |
{ |
int i; /* current input position in p->buf */ |
int i; /* current input position in p->buf */ |
|
int ntab; /* number of tabs to prepend */ |
size_t vis; /* current visual position on output */ |
size_t vis; /* current visual position on output */ |
size_t vbl; /* number of blanks to prepend to output */ |
size_t vbl; /* number of blanks to prepend to output */ |
size_t vend; /* end of word visual position on output */ |
size_t vend; /* end of word visual position on output */ |
Line 144 term_flushln(struct termp *p) |
|
Line 145 term_flushln(struct termp *p) |
|
* Handle literal tab characters: collapse all |
* Handle literal tab characters: collapse all |
* subsequent tabs into a single huge set of spaces. |
* subsequent tabs into a single huge set of spaces. |
*/ |
*/ |
|
ntab = 0; |
while (i < p->col && '\t' == p->buf[i]) { |
while (i < p->col && '\t' == p->buf[i]) { |
vend = (vis / p->tabwidth + 1) * p->tabwidth; |
vend = (vis / p->tabwidth + 1) * p->tabwidth; |
vbl += vend - vis; |
vbl += vend - vis; |
vis = vend; |
vis = vend; |
|
ntab++; |
i++; |
i++; |
} |
} |
|
|
Line 191 term_flushln(struct termp *p) |
|
Line 194 term_flushln(struct termp *p) |
|
vend += p->rmargin - p->offset; |
vend += p->rmargin - p->offset; |
} else |
} else |
vbl = p->offset; |
vbl = p->offset; |
|
|
|
/* use pending tabs on the new line */ |
|
|
|
if (0 < ntab) |
|
vbl += ntab * p->tabwidth; |
|
|
/* Remove the p->overstep width. */ |
/* Remove the p->overstep width. */ |
|
|