version 1.278, 2019/01/03 19:59:55 |
version 1.281, 2019/06/03 20:23:41 |
Line 135 term_flushln(struct termp *p) |
|
Line 135 term_flushln(struct termp *p) |
|
/* |
/* |
* Figure out how much text will fit in the field. |
* Figure out how much text will fit in the field. |
* If there is whitespace only, print nothing. |
* If there is whitespace only, print nothing. |
* Otherwise, print the field content. |
|
*/ |
*/ |
|
|
term_fill(p, &nbr, &vbr, vtarget); |
term_fill(p, &nbr, &vbr, vtarget); |
if (nbr == 0) |
if (nbr == 0) |
break; |
break; |
|
|
|
/* |
|
* With the CENTER or RIGHT flag, increase the indentation |
|
* to center the text between the left and right margins |
|
* or to adjust it to the right margin, respectively. |
|
*/ |
|
|
|
if (vbr < vtarget) { |
|
if (p->flags & TERMP_CENTER) |
|
vbl += (vtarget - vbr) / 2; |
|
else if (p->flags & TERMP_RIGHT) |
|
vbl += vtarget - vbr; |
|
} |
|
|
|
/* Finally, print the field content. */ |
|
|
term_field(p, vbl, nbr, vbr, vtarget); |
term_field(p, vbl, nbr, vbr, vtarget); |
|
|
/* |
/* |
Line 267 term_fill(struct termp *p, size_t *nbr, size_t *vbr, s |
|
Line 281 term_fill(struct termp *p, size_t *nbr, size_t *vbr, s |
|
case ASCII_BREAK: |
case ASCII_BREAK: |
vn = vis; |
vn = vis; |
break; |
break; |
|
default: |
|
abort(); |
} |
} |
/* Can break at the end of a word. */ |
/* Can break at the end of a word. */ |
if (breakline || vn > vtarget) |
if (breakline || vn > vtarget) |
Line 360 term_field(struct termp *p, size_t vbl, size_t nbr, si |
|
Line 376 term_field(struct termp *p, size_t vbl, size_t nbr, si |
|
continue; |
continue; |
case ' ': |
case ' ': |
case ASCII_NBRSP: |
case ASCII_NBRSP: |
vbl++; |
dv = (*p->width)(p, ' '); |
vis++; |
vbl += dv; |
|
vis += dv; |
continue; |
continue; |
default: |
default: |
break; |
break; |