version 1.11, 2009/07/22 15:55:32 |
version 1.12, 2009/07/22 16:45:31 |
|
|
void tty_attributes_fg(struct tty *, const struct grid_cell *); |
void tty_attributes_fg(struct tty *, const struct grid_cell *); |
void tty_attributes_bg(struct tty *, const struct grid_cell *); |
void tty_attributes_bg(struct tty *, const struct grid_cell *); |
|
|
void tty_cmd_alignmenttest(struct tty *, struct window_pane *, va_list); |
void tty_cmd_alignmenttest(struct tty *, struct tty_ctx *); |
void tty_cmd_cell(struct tty *, struct window_pane *, va_list); |
void tty_cmd_cell(struct tty *, struct tty_ctx *); |
void tty_cmd_clearendofline(struct tty *, struct window_pane *, va_list); |
void tty_cmd_clearendofline(struct tty *, struct tty_ctx *); |
void tty_cmd_clearendofscreen(struct tty *, struct window_pane *, va_list); |
void tty_cmd_clearendofscreen(struct tty *, struct tty_ctx *); |
void tty_cmd_clearline(struct tty *, struct window_pane *, va_list); |
void tty_cmd_clearline(struct tty *, struct tty_ctx *); |
void tty_cmd_clearscreen(struct tty *, struct window_pane *, va_list); |
void tty_cmd_clearscreen(struct tty *, struct tty_ctx *); |
void tty_cmd_clearstartofline(struct tty *, struct window_pane *, va_list); |
void tty_cmd_clearstartofline(struct tty *, struct tty_ctx *); |
void tty_cmd_clearstartofscreen(struct tty *, struct window_pane *, va_list); |
void tty_cmd_clearstartofscreen(struct tty *, struct tty_ctx *); |
void tty_cmd_deletecharacter(struct tty *, struct window_pane *, va_list); |
void tty_cmd_deletecharacter(struct tty *, struct tty_ctx *); |
void tty_cmd_deleteline(struct tty *, struct window_pane *, va_list); |
void tty_cmd_deleteline(struct tty *, struct tty_ctx *); |
void tty_cmd_insertcharacter(struct tty *, struct window_pane *, va_list); |
void tty_cmd_insertcharacter(struct tty *, struct tty_ctx *); |
void tty_cmd_insertline(struct tty *, struct window_pane *, va_list); |
void tty_cmd_insertline(struct tty *, struct tty_ctx *); |
void tty_cmd_linefeed(struct tty *, struct window_pane *, va_list); |
void tty_cmd_linefeed(struct tty *, struct tty_ctx *); |
void tty_cmd_utf8character(struct tty *, struct window_pane *, va_list); |
void tty_cmd_utf8character(struct tty *, struct tty_ctx *); |
void tty_cmd_reverseindex(struct tty *, struct window_pane *, va_list); |
void tty_cmd_reverseindex(struct tty *, struct tty_ctx *); |
|
|
void (*tty_cmds[])(struct tty *, struct window_pane *, va_list) = { |
void (*tty_cmds[])(struct tty *, struct tty_ctx *) = { |
tty_cmd_alignmenttest, |
tty_cmd_alignmenttest, |
tty_cmd_cell, |
tty_cmd_cell, |
tty_cmd_clearendofline, |
tty_cmd_clearendofline, |
|
|
} |
} |
|
|
void |
void |
tty_vwrite( |
tty_write(struct tty *tty, enum tty_cmd cmd, struct tty_ctx *ctx) |
struct tty *tty, struct window_pane *wp, enum tty_cmd cmd, va_list ap) |
|
{ |
{ |
if (tty->flags & TTY_FREEZE || tty->term == NULL) |
if (tty->flags & TTY_FREEZE || tty->term == NULL) |
return; |
return; |
if (tty_cmds[cmd] != NULL) |
if (tty_cmds[cmd] != NULL) |
tty_cmds[cmd](tty, wp, ap); |
tty_cmds[cmd](tty, ctx); |
} |
} |
|
|
void |
void |
tty_cmd_insertcharacter(struct tty *tty, struct window_pane *wp, va_list ap) |
tty_cmd_insertcharacter(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int ua; |
struct screen *s = wp->screen; |
|
|
if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { |
if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { |
tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); |
tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); |
return; |
return; |
} |
} |
|
|
ua = va_arg(ap, u_int); |
|
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
if (tty_term_has(tty->term, TTYC_ICH) || |
if (tty_term_has(tty->term, TTYC_ICH) || |
tty_term_has(tty->term, TTYC_ICH1)) |
tty_term_has(tty->term, TTYC_ICH1)) |
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ua); |
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num); |
else { |
else { |
tty_putcode(tty, TTYC_SMIR); |
tty_putcode(tty, TTYC_SMIR); |
while (ua-- > 0) |
while (ctx->num-- > 0) |
tty_putc(tty, ' '); |
tty_putc(tty, ' '); |
tty_putcode(tty, TTYC_RMIR); |
tty_putcode(tty, TTYC_RMIR); |
} |
} |
} |
} |
|
|
void |
void |
tty_cmd_deletecharacter(struct tty *tty, struct window_pane *wp, va_list ap) |
tty_cmd_deletecharacter(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int ua; |
struct screen *s = wp->screen; |
|
|
if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { |
if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { |
tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); |
tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); |
return; |
return; |
} |
} |
|
|
ua = va_arg(ap, u_int); |
|
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ua); |
tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ctx->num); |
} |
} |
|
|
void |
void |
tty_cmd_insertline(struct tty *tty, struct window_pane *wp, va_list ap) |
tty_cmd_insertline(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int ua; |
struct screen *s = wp->screen; |
|
|
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
!tty_term_has(tty->term, TTYC_CSR)) { |
!tty_term_has(tty->term, TTYC_CSR)) { |
|
|
return; |
return; |
} |
} |
|
|
ua = va_arg(ap, u_int); |
|
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff); |
tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff); |
|
|
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ua); |
tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num); |
} |
} |
|
|
void |
void |
tty_cmd_deleteline(struct tty *tty, struct window_pane *wp, va_list ap) |
tty_cmd_deleteline(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int ua; |
struct screen *s = wp->screen; |
|
|
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
!tty_term_has(tty->term, TTYC_CSR)) { |
!tty_term_has(tty->term, TTYC_CSR)) { |
|
|
return; |
return; |
} |
} |
|
|
ua = va_arg(ap, u_int); |
|
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff); |
tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff); |
|
|
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ua); |
tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num); |
} |
} |
|
|
void |
void |
tty_cmd_clearline(struct tty *tty, struct window_pane *wp, unused va_list ap) |
tty_cmd_clearline(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int i; |
struct screen *s = wp->screen; |
|
u_int i; |
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
|
|
} |
} |
|
|
void |
void |
tty_cmd_clearendofline( |
tty_cmd_clearendofline(struct tty *tty, struct tty_ctx *ctx) |
struct tty *tty, struct window_pane *wp, unused va_list ap) |
|
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int i; |
struct screen *s = wp->screen; |
|
u_int i; |
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
|
|
} |
} |
|
|
void |
void |
tty_cmd_clearstartofline( |
tty_cmd_clearstartofline(struct tty *tty, struct tty_ctx *ctx) |
struct tty *tty, struct window_pane *wp, unused va_list ap) |
|
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int i; |
struct screen *s = wp->screen; |
|
u_int i; |
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
|
|
} |
} |
|
|
void |
void |
tty_cmd_reverseindex(struct tty *tty, struct window_pane *wp, unused va_list ap) |
tty_cmd_reverseindex(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
|
struct screen *s = wp->screen; |
|
|
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
!tty_term_has(tty->term, TTYC_CSR)) { |
!tty_term_has(tty->term, TTYC_CSR)) { |
|
|
} |
} |
|
|
void |
void |
tty_cmd_linefeed(struct tty *tty, struct window_pane *wp, unused va_list ap) |
tty_cmd_linefeed(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
|
struct screen *s = wp->screen; |
|
|
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
if (wp->xoff != 0 || screen_size_x(s) < tty->sx || |
!tty_term_has(tty->term, TTYC_CSR)) { |
!tty_term_has(tty->term, TTYC_CSR)) { |
|
|
} |
} |
|
|
void |
void |
tty_cmd_clearendofscreen( |
tty_cmd_clearendofscreen(struct tty *tty, struct tty_ctx *ctx) |
struct tty *tty, struct window_pane *wp, unused va_list ap) |
|
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int i, j; |
struct screen *s = wp->screen; |
|
u_int i, j; |
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
|
|
} |
} |
|
|
void |
void |
tty_cmd_clearstartofscreen( |
tty_cmd_clearstartofscreen(struct tty *tty, struct tty_ctx *ctx) |
struct tty *tty, struct window_pane *wp, unused va_list ap) |
|
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int i, j; |
struct screen *s = wp->screen; |
|
u_int i, j; |
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
|
|
} |
} |
|
|
void |
void |
tty_cmd_clearscreen( |
tty_cmd_clearscreen(struct tty *tty, struct tty_ctx *ctx) |
struct tty *tty, struct window_pane *wp, unused va_list ap) |
|
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int i, j; |
struct screen *s = wp->screen; |
|
u_int i, j; |
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
|
|
} |
} |
|
|
void |
void |
tty_cmd_alignmenttest( |
tty_cmd_alignmenttest(struct tty *tty, struct tty_ctx *ctx) |
struct tty *tty, struct window_pane *wp, unused va_list ap) |
|
{ |
{ |
struct screen *s = wp->screen; |
struct window_pane *wp = ctx->wp; |
u_int i, j; |
struct screen *s = wp->screen; |
|
u_int i, j; |
|
|
tty_reset(tty); |
tty_reset(tty); |
|
|
|
|
} |
} |
|
|
void |
void |
tty_cmd_cell(struct tty *tty, struct window_pane *wp, va_list ap) |
tty_cmd_cell(struct tty *tty, struct tty_ctx *ctx) |
{ |
{ |
|
struct window_pane *wp = ctx->wp; |
struct screen *s = wp->screen; |
struct screen *s = wp->screen; |
struct grid_cell *gc; |
|
struct grid_utf8 *gu; |
|
|
|
gc = va_arg(ap, struct grid_cell *); |
|
gu = va_arg(ap, struct grid_utf8 *); |
|
|
|
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); |
|
|
tty_cell(tty, gc, gu); |
tty_cell(tty, ctx->cell, ctx->utf8); |
} |
} |
|
|
void |
void |
tty_cmd_utf8character( |
tty_cmd_utf8character(struct tty *tty, struct tty_ctx *ctx) |
struct tty *tty, unused struct window_pane *wp, va_list ap) |
|
{ |
{ |
u_char *buf; |
u_char *ptr = ctx->ptr; |
size_t i; |
size_t i; |
|
|
buf = va_arg(ap, u_char *); |
|
|
|
for (i = 0; i < UTF8_SIZE; i++) { |
for (i = 0; i < UTF8_SIZE; i++) { |
if (buf[i] == 0xff) |
if (ptr[i] == 0xff) |
break; |
break; |
tty_putc(tty, buf[i]); |
tty_putc(tty, ptr[i]); |
} |
} |
} |
} |
|
|