version 1.139, 2010/05/24 21:51:20 |
version 1.140, 2010/05/25 12:37:20 |
Line 138 term_flushln(struct termp *p) |
|
Line 138 term_flushln(struct termp *p) |
|
size_t vend; /* end of word visual position on output */ |
size_t vend; /* end of word visual position on output */ |
size_t bp; /* visual right border position */ |
size_t bp; /* visual right border position */ |
int j; /* temporary loop index */ |
int j; /* temporary loop index */ |
|
int jhy; /* last hyphen before line overflow */ |
size_t maxvis, mmax; |
size_t maxvis, mmax; |
|
|
/* |
/* |
Line 190 term_flushln(struct termp *p) |
|
Line 191 term_flushln(struct termp *p) |
|
*/ |
*/ |
|
|
/* LINTED */ |
/* LINTED */ |
for ( ; j < (int)p->col; j++) { |
for (jhy = 0; j < (int)p->col; j++) { |
if ((j && ' ' == p->buf[j]) || '\t' == 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--; |
if (vend > vis && vend < bp && |
else |
ASCII_HYPH == p->buf[j]) |
|
jhy = j; |
vend++; |
vend++; |
|
} else |
|
vend--; |
} |
} |
|
|
/* |
/* |
* Find out whether we would exceed the right margin. |
* Find out whether we would exceed the right margin. |
* If so, break to the next line. |
* If so, break to the next line. |
*/ |
*/ |
if (vend > bp && vis > 0) { |
if (vend > bp && 0 == jhy && vis > 0) { |
vend -= vis; |
vend -= vis; |
putchar('\n'); |
putchar('\n'); |
if (TERMP_NOBREAK & p->flags) { |
if (TERMP_NOBREAK & p->flags) { |
Line 231 term_flushln(struct termp *p) |
|
Line 235 term_flushln(struct termp *p) |
|
|
|
/* Write out the [remaining] word. */ |
/* Write out the [remaining] word. */ |
for ( ; i < (int)p->col; i++) { |
for ( ; i < (int)p->col; i++) { |
|
if (vend > bp && jhy > 0 && i > jhy) |
|
break; |
if ('\t' == p->buf[i]) |
if ('\t' == p->buf[i]) |
break; |
break; |
if (' ' == p->buf[i]) { |
if (' ' == p->buf[i]) { |
Line 256 term_flushln(struct termp *p) |
|
Line 262 term_flushln(struct termp *p) |
|
p->viscol += vbl; |
p->viscol += vbl; |
vbl = 0; |
vbl = 0; |
} |
} |
putchar(p->buf[i]); |
|
|
if (ASCII_HYPH == p->buf[i]) |
|
putchar('-'); |
|
else |
|
putchar(p->buf[i]); |
|
|
p->viscol += 1; |
p->viscol += 1; |
} |
} |
vend += vbl; |
vend += vbl; |