version 1.137, 2010/05/17 22:11:42 |
version 1.138, 2010/05/24 21:34:16 |
Line 84 term_alloc(enum termenc enc, size_t width) |
|
Line 84 term_alloc(enum termenc enc, size_t width) |
|
perror(NULL); |
perror(NULL); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
|
p->tabwidth = 5; |
p->enc = enc; |
p->enc = enc; |
/* Enforce some lower boundary. */ |
/* Enforce some lower boundary. */ |
if (width < 60) |
if (width < 60) |
Line 171 term_flushln(struct termp *p) |
|
Line 172 term_flushln(struct termp *p) |
|
while (i < (int)p->col) { |
while (i < (int)p->col) { |
|
|
/* |
/* |
|
* Handle literal tab characters. |
|
*/ |
|
for (j = i; j < (int)p->col; j++) { |
|
if ('\t' != p->buf[j]) |
|
break; |
|
vend = (vis/p->tabwidth+1)*p->tabwidth; |
|
vbl += vend - vis; |
|
vis = vend; |
|
} |
|
|
|
/* |
* Count up visible word characters. Control sequences |
* Count up visible word characters. Control sequences |
* (starting with the CSI) aren't counted. A space |
* (starting with the CSI) aren't counted. A space |
* generates a non-printing word, which is valid (the |
* generates a non-printing word, which is valid (the |
Line 178 term_flushln(struct termp *p) |
|
Line 190 term_flushln(struct termp *p) |
|
*/ |
*/ |
|
|
/* LINTED */ |
/* LINTED */ |
for (j = i; j < (int)p->col; j++) { |
for ( ; j < (int)p->col; j++) { |
if (j && ' ' == p->buf[j]) |
if ((j && ' ' == p->buf[j]) || '\t' == p->buf[j]) |
break; |
break; |
if (8 == p->buf[j]) |
if (8 == p->buf[j]) |
vend--; |
vend--; |
Line 209 term_flushln(struct termp *p) |
|
Line 221 term_flushln(struct termp *p) |
|
p->overstep = 0; |
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. */ |
/* Write out the [remaining] word. */ |
for ( ; i < (int)p->col; i++) { |
for ( ; i < (int)p->col; i++) { |
|
if ('\t' == p->buf[i]) |
|
break; |
if (' ' == p->buf[i]) { |
if (' ' == p->buf[i]) { |
while (' ' == p->buf[i]) { |
while (' ' == p->buf[i]) { |
vbl++; |
vbl++; |