version 1.126, 2009/11/12 05:58:30 |
version 1.129, 2010/03/23 12:42:22 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
*/ |
*/ |
|
#ifdef HAVE_CONFIG_H |
|
#include "config.h" |
|
#endif |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <assert.h> |
#include <assert.h> |
Line 79 term_alloc(enum termenc enc) |
|
Line 83 term_alloc(enum termenc enc) |
|
perror(NULL); |
perror(NULL); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
p->maxrmargin = 78; |
|
p->enc = enc; |
p->enc = enc; |
return(p); |
return(p); |
} |
} |
Line 132 term_flushln(struct termp *p) |
|
Line 135 term_flushln(struct termp *p) |
|
size_t bp; /* visual right border position */ |
size_t bp; /* visual right border position */ |
int j; /* temporary loop index */ |
int j; /* temporary loop index */ |
size_t maxvis, mmax; |
size_t maxvis, mmax; |
static int overstep = 0; |
|
|
|
/* |
/* |
* First, establish the maximum columns of "visible" content. |
* First, establish the maximum columns of "visible" content. |
Line 143 term_flushln(struct termp *p) |
|
Line 145 term_flushln(struct termp *p) |
|
|
|
assert(p->offset < p->rmargin); |
assert(p->offset < p->rmargin); |
|
|
maxvis = (int)(p->rmargin - p->offset) - overstep < 0 ? |
maxvis = (int)(p->rmargin - p->offset) - p->overstep < 0 ? |
/* LINTED */ |
/* LINTED */ |
0 : p->rmargin - p->offset - overstep; |
0 : p->rmargin - p->offset - p->overstep; |
mmax = (int)(p->maxrmargin - p->offset) - overstep < 0 ? |
mmax = (int)(p->maxrmargin - p->offset) - p->overstep < 0 ? |
/* LINTED */ |
/* LINTED */ |
0 : p->maxrmargin - p->offset - overstep; |
0 : p->maxrmargin - p->offset - p->overstep; |
|
|
bp = TERMP_NOBREAK & p->flags ? mmax : maxvis; |
bp = TERMP_NOBREAK & p->flags ? mmax : maxvis; |
|
|
Line 211 term_flushln(struct termp *p) |
|
Line 213 term_flushln(struct termp *p) |
|
putchar(' '); |
putchar(' '); |
vis = 0; |
vis = 0; |
} |
} |
/* Remove the overstep width. */ |
/* Remove the p->overstep width. */ |
bp += (int)/* LINTED */ |
bp += (int)/* LINTED */ |
overstep; |
p->overstep; |
overstep = 0; |
p->overstep = 0; |
} else { |
} else { |
for (j = 0; j < (int)vbl; j++) |
for (j = 0; j < (int)vbl; j++) |
putchar(' '); |
putchar(' '); |
Line 238 term_flushln(struct termp *p) |
|
Line 240 term_flushln(struct termp *p) |
|
} |
} |
|
|
p->col = 0; |
p->col = 0; |
overstep = 0; |
p->overstep = 0; |
|
|
if ( ! (TERMP_NOBREAK & p->flags)) { |
if ( ! (TERMP_NOBREAK & p->flags)) { |
putchar('\n'); |
putchar('\n'); |
Line 247 term_flushln(struct termp *p) |
|
Line 249 term_flushln(struct termp *p) |
|
|
|
if (TERMP_HANG & p->flags) { |
if (TERMP_HANG & p->flags) { |
/* We need one blank after the tag. */ |
/* We need one blank after the tag. */ |
overstep = /* LINTED */ |
p->overstep = /* LINTED */ |
vis - maxvis + 1; |
vis - maxvis + 1; |
|
|
/* |
/* |
Line 260 term_flushln(struct termp *p) |
|
Line 262 term_flushln(struct termp *p) |
|
* move it one step LEFT and flag the rest of the line |
* move it one step LEFT and flag the rest of the line |
* to be longer. |
* to be longer. |
*/ |
*/ |
if (overstep >= -1) { |
if (p->overstep >= -1) { |
assert((int)maxvis + overstep >= 0); |
assert((int)maxvis + p->overstep >= 0); |
/* LINTED */ |
/* LINTED */ |
maxvis += overstep; |
maxvis += p->overstep; |
} else |
} else |
overstep = 0; |
p->overstep = 0; |
|
|
} else if (TERMP_DANGLE & p->flags) |
} else if (TERMP_DANGLE & p->flags) |
return; |
return; |
Line 487 term_word(struct termp *p, const char *word) |
|
Line 489 term_word(struct termp *p, const char *word) |
|
default: |
default: |
break; |
break; |
} |
} |
|
|
word += sz; |
word += sz; |
|
if (DECO_NOSPACE == deco && '\0' == *word) |
|
p->flags |= TERMP_NOSPACE; |
} |
} |
|
|
if (sv[0] && 0 == sv[1]) |
if (sv[0] && 0 == sv[1]) |