From b6afa30c3954d2d98304ea69b1375d7b51091cc9 Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Wed, 22 Jul 2009 18:08:56 +0000 Subject: [PATCH] Sync OpenBSD patchset 159: There are relatively few arguments to tty_cmd_* functions now, so tidy them up by using a struct rather than hiding everything with varargs. --- screen-write.c | 48 +++++++------- tmux.h | 20 ++++-- tty-write.c | 50 ++++++++++----- tty.c | 167 +++++++++++++++++++++++-------------------------- 4 files changed, 155 insertions(+), 130 deletions(-) diff --git a/screen-write.c b/screen-write.c index 41fcf38d..f0a28866 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $Id: screen-write.c,v 1.61 2009-07-22 17:58:42 tcunha Exp $ */ +/* $Id: screen-write.c,v 1.62 2009-07-22 18:08:56 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -327,7 +327,7 @@ screen_write_alignmenttest(struct screen_write_ctx *ctx) s->rupper = 0; s->rlower = screen_size_y(s) - 1; - tty_write_cmd(ctx->wp, TTY_ALIGNMENTTEST); + tty_write0(ctx->wp, TTY_ALIGNMENTTEST); } /* Insert nx characters. */ @@ -349,7 +349,7 @@ screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx) if (s->cx <= screen_size_x(s) - 1) grid_view_insert_cells(s->grid, s->cx, s->cy, nx); - tty_write_cmd(ctx->wp, TTY_INSERTCHARACTER, nx); + tty_writenum(ctx->wp, TTY_INSERTCHARACTER, nx); } /* Delete nx characters. */ @@ -371,7 +371,7 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx) if (s->cx <= screen_size_x(s) - 1) grid_view_delete_cells(s->grid, s->cx, s->cy, nx); - tty_write_cmd(ctx->wp, TTY_DELETECHARACTER, nx); + tty_writenum(ctx->wp, TTY_DELETECHARACTER, nx); } /* Insert ny lines. */ @@ -393,7 +393,7 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny) grid_view_insert_lines(s->grid, s->cy, ny); - tty_write_cmd(ctx->wp, TTY_INSERTLINE, ny); + tty_writenum(ctx->wp, TTY_INSERTLINE, ny); return; } @@ -409,7 +409,7 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny) else grid_view_insert_lines_region(s->grid, s->rlower, s->cy, ny); - tty_write_cmd(ctx->wp, TTY_INSERTLINE, ny); + tty_writenum(ctx->wp, TTY_INSERTLINE, ny); } /* Delete ny lines. */ @@ -431,7 +431,7 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny) grid_view_delete_lines(s->grid, s->cy, ny); - tty_write_cmd(ctx->wp, TTY_DELETELINE, ny); + tty_writenum(ctx->wp, TTY_DELETELINE, ny); return; } @@ -447,7 +447,7 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny) else grid_view_delete_lines_region(s->grid, s->rlower, s->cy, ny); - tty_write_cmd(ctx->wp, TTY_DELETELINE, ny); + tty_writenum(ctx->wp, TTY_DELETELINE, ny); } /* Clear line at cursor. */ @@ -460,7 +460,7 @@ screen_write_clearline(struct screen_write_ctx *ctx) grid_view_clear(s->grid, 0, s->cy, screen_size_x(s), 1); - tty_write_cmd(ctx->wp, TTY_CLEARLINE); + tty_writenum(ctx->wp, TTY_CLEARLINE, 0); } /* Clear to end of line from cursor. */ @@ -477,7 +477,7 @@ screen_write_clearendofline(struct screen_write_ctx *ctx) if (s->cx <= sx - 1) grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); - tty_write_cmd(ctx->wp, TTY_CLEARENDOFLINE); + tty_writenum(ctx->wp, TTY_CLEARENDOFLINE, 0); } /* Clear to start of line from cursor. */ @@ -496,7 +496,7 @@ screen_write_clearstartofline(struct screen_write_ctx *ctx) else grid_view_clear(s->grid, 0, s->cy, s->cx + 1, 1); - tty_write_cmd(ctx->wp, TTY_CLEARSTARTOFLINE); + tty_writenum(ctx->wp, TTY_CLEARSTARTOFLINE, 0); } /* Move cursor to px,py. */ @@ -539,7 +539,7 @@ screen_write_reverseindex(struct screen_write_ctx *ctx) else if (s->cy > 0) s->cy--; - tty_write_cmd(ctx->wp, TTY_REVERSEINDEX); + tty_writenum(ctx->wp, TTY_REVERSEINDEX, 0); } /* Set scroll region. */ @@ -601,7 +601,7 @@ screen_write_linefeed(struct screen_write_ctx *ctx) else if (s->cy < screen_size_y(s) - 1) s->cy++; - tty_write_cmd(ctx->wp, TTY_LINEFEED); + tty_writenum(ctx->wp, TTY_LINEFEED, 0); } /* Carriage return (cursor to start of line). */ @@ -653,7 +653,7 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx) grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1)); - tty_write_cmd(ctx->wp, TTY_CLEARENDOFSCREEN); + tty_writenum(ctx->wp, TTY_CLEARENDOFSCREEN, 0); } /* Clear to start of screen. */ @@ -674,7 +674,7 @@ screen_write_clearstartofscreen(struct screen_write_ctx *ctx) else grid_view_clear(s->grid, 0, s->cy, s->cx + 1, 1); - tty_write_cmd(ctx->wp, TTY_CLEARSTARTOFSCREEN); + tty_writenum(ctx->wp, TTY_CLEARSTARTOFSCREEN, 0); } /* Clear entire screen. */ @@ -687,7 +687,7 @@ screen_write_clearscreen(struct screen_write_ctx *ctx) grid_view_clear(s->grid, 0, 0, screen_size_x(s), screen_size_y(s)); - tty_write_cmd(ctx->wp, TTY_CLEARSCREEN); + tty_writenum(ctx->wp, TTY_CLEARSCREEN, 0); } /* Write cell data. */ @@ -697,6 +697,7 @@ screen_write_cell( { struct screen *s = ctx->s; struct grid *gd = s->grid; + struct tty_ctx ttyctx; struct grid_utf8 gu, *tmp_gu; u_int width, xx, i; struct grid_cell tmp_gc, *tmp_gc2; @@ -736,7 +737,7 @@ screen_write_cell( memcpy(tmp_gu->data + i, udata, UTF8_SIZE - i); /* Assume the previous character has just been input. */ - tty_write_cmd(ctx->wp, TTY_UTF8CHARACTER, udata); + tty_writeptr(ctx->wp, TTY_UTF8CHARACTER, udata); return; } @@ -789,12 +790,17 @@ screen_write_cell( /* Draw to the screen if necessary. */ if (insert) - tty_write_cmd(ctx->wp, TTY_INSERTCHARACTER, width); + tty_writenum(ctx->wp, TTY_INSERTCHARACTER, width); + ttyctx.wp = ctx->wp; + ttyctx.utf8 = &gu; if (screen_check_selection(s, s->cx - width, s->cy)) { s->sel.cell.data = gc->data; - tty_write_cmd(ctx->wp, TTY_CELL, &s->sel.cell, &gu); - } else - tty_write_cmd(ctx->wp, TTY_CELL, gc, &gu); + ttyctx.cell = &s->sel.cell; + tty_write_cmd(TTY_CELL, &ttyctx); + } else { + ttyctx.cell = gc; + tty_write_cmd(TTY_CELL, &ttyctx); + } } /* diff --git a/tmux.h b/tmux.h index d04d1207..8f7b1c7d 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.381 2009-07-22 17:58:42 tcunha Exp $ */ +/* $Id: tmux.h,v 1.382 2009-07-22 18:08:56 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -291,6 +291,16 @@ enum tty_cmd { TTY_REVERSEINDEX, }; +struct tty_ctx { + struct window_pane *wp; + + const struct grid_cell *cell; + const struct grid_utf8 *utf8; + + u_int num; + void *ptr; +}; + /* Message codes. */ enum hdrtype { MSG_COMMAND, @@ -1047,8 +1057,7 @@ void tty_redraw_region(struct tty *, struct window_pane *); int tty_open(struct tty *, char **); void tty_close(struct tty *, int); void tty_free(struct tty *, int); -void tty_vwrite( - struct tty *, struct window_pane *, enum tty_cmd, va_list); +void tty_write(struct tty *, enum tty_cmd, struct tty_ctx *); /* tty-term.c */ extern struct tty_terms tty_terms; @@ -1071,7 +1080,10 @@ void tty_keys_free(struct tty *); int tty_keys_next(struct tty *, int *, u_char *); /* tty-write.c */ -void tty_write_cmd(struct window_pane *, enum tty_cmd, ...); +void tty_write0(struct window_pane *, enum tty_cmd); +void tty_writenum(struct window_pane *, enum tty_cmd, u_int); +void tty_writeptr(struct window_pane *, enum tty_cmd, void *); +void tty_write_cmd(enum tty_cmd, struct tty_ctx *); /* options-cmd.c */ void set_option_string(struct cmd_ctx *, diff --git a/tty-write.c b/tty-write.c index 5f13bbda..08c2981b 100644 --- a/tty-write.c +++ b/tty-write.c @@ -1,4 +1,4 @@ -/* $Id: tty-write.c,v 1.19 2009-07-15 17:42:44 nicm Exp $ */ +/* $Id: tty-write.c,v 1.20 2009-07-22 18:08:56 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -18,26 +18,48 @@ #include +#include + #include "tmux.h" -void tty_vwrite_cmd(struct window_pane *, enum tty_cmd, va_list); - void -tty_write_cmd(struct window_pane *wp, enum tty_cmd cmd, ...) +tty_write0(struct window_pane *wp, enum tty_cmd cmd) { - va_list ap; + struct tty_ctx ctx; - va_start(ap, cmd); - tty_vwrite_cmd(wp, cmd, ap); - va_end(ap); + memset(&ctx, 0, sizeof ctx); + ctx.wp = wp; + tty_write_cmd(cmd, &ctx); } void -tty_vwrite_cmd(struct window_pane *wp, enum tty_cmd cmd, va_list ap) +tty_writenum(struct window_pane *wp, enum tty_cmd cmd, u_int num) { - struct client *c; - va_list aq; - u_int i; + struct tty_ctx ctx; + + memset(&ctx, 0, sizeof ctx); + ctx.wp = wp; + ctx.num = num; + tty_write_cmd(cmd, &ctx); +} + +void +tty_writeptr(struct window_pane *wp, enum tty_cmd cmd, void *ptr) +{ + struct tty_ctx ctx; + + memset(&ctx, 0, sizeof ctx); + ctx.wp = wp; + ctx.ptr = ptr; + tty_write_cmd(cmd, &ctx); +} + +void +tty_write_cmd(enum tty_cmd cmd, struct tty_ctx *ctx) +{ + struct window_pane *wp = ctx->wp; + struct client *c; + u_int i; if (wp == NULL) return; @@ -57,9 +79,7 @@ tty_vwrite_cmd(struct window_pane *wp, enum tty_cmd cmd, va_list ap) if (c->session->curw->window == wp->window) { tty_update_mode(&c->tty, c->tty.mode & ~MODE_CURSOR); - va_copy(aq, ap); - tty_vwrite(&c->tty, wp, cmd, aq); - va_end(aq); + tty_write(&c->tty, cmd, ctx); } } } diff --git a/tty.c b/tty.c index 39411ce5..52d23664 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.114 2009-07-22 17:58:42 tcunha Exp $ */ +/* $Id: tty.c,v 1.115 2009-07-22 18:08:56 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -38,23 +38,23 @@ void tty_attributes(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_cmd_alignmenttest(struct tty *, struct window_pane *, va_list); -void tty_cmd_cell(struct tty *, struct window_pane *, va_list); -void tty_cmd_clearendofline(struct tty *, struct window_pane *, va_list); -void tty_cmd_clearendofscreen(struct tty *, struct window_pane *, va_list); -void tty_cmd_clearline(struct tty *, struct window_pane *, va_list); -void tty_cmd_clearscreen(struct tty *, struct window_pane *, va_list); -void tty_cmd_clearstartofline(struct tty *, struct window_pane *, va_list); -void tty_cmd_clearstartofscreen(struct tty *, struct window_pane *, va_list); -void tty_cmd_deletecharacter(struct tty *, struct window_pane *, va_list); -void tty_cmd_deleteline(struct tty *, struct window_pane *, va_list); -void tty_cmd_insertcharacter(struct tty *, struct window_pane *, va_list); -void tty_cmd_insertline(struct tty *, struct window_pane *, va_list); -void tty_cmd_linefeed(struct tty *, struct window_pane *, va_list); -void tty_cmd_utf8character(struct tty *, struct window_pane *, va_list); -void tty_cmd_reverseindex(struct tty *, struct window_pane *, va_list); +void tty_cmd_alignmenttest(struct tty *, struct tty_ctx *); +void tty_cmd_cell(struct tty *, struct tty_ctx *); +void tty_cmd_clearendofline(struct tty *, struct tty_ctx *); +void tty_cmd_clearendofscreen(struct tty *, struct tty_ctx *); +void tty_cmd_clearline(struct tty *, struct tty_ctx *); +void tty_cmd_clearscreen(struct tty *, struct tty_ctx *); +void tty_cmd_clearstartofline(struct tty *, struct tty_ctx *); +void tty_cmd_clearstartofscreen(struct tty *, struct tty_ctx *); +void tty_cmd_deletecharacter(struct tty *, struct tty_ctx *); +void tty_cmd_deleteline(struct tty *, struct tty_ctx *); +void tty_cmd_insertcharacter(struct tty *, struct tty_ctx *); +void tty_cmd_insertline(struct tty *, struct tty_ctx *); +void tty_cmd_linefeed(struct tty *, struct tty_ctx *); +void tty_cmd_utf8character(struct tty *, struct tty_ctx *); +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_cell, tty_cmd_clearendofline, @@ -555,66 +555,61 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy) } void -tty_vwrite( - struct tty *tty, struct window_pane *wp, enum tty_cmd cmd, va_list ap) +tty_write(struct tty *tty, enum tty_cmd cmd, struct tty_ctx *ctx) { if (tty->flags & TTY_FREEZE || tty->term == NULL) return; if (tty_cmds[cmd] != NULL) - tty_cmds[cmd](tty, wp, ap); + tty_cmds[cmd](tty, ctx); } 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; - u_int ua; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); return; } - ua = va_arg(ap, u_int); - tty_reset(tty); tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); if (tty_term_has(tty->term, TTYC_ICH) || 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 { tty_putcode(tty, TTYC_SMIR); - while (ua-- > 0) + while (ctx->num-- > 0) tty_putc(tty, ' '); tty_putcode(tty, TTYC_RMIR); } } 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; - u_int ua; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); return; } - ua = va_arg(ap, u_int); - tty_reset(tty); 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 -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; - u_int ua; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; if (wp->xoff != 0 || screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) { @@ -622,21 +617,19 @@ tty_cmd_insertline(struct tty *tty, struct window_pane *wp, va_list ap) return; } - ua = va_arg(ap, u_int); - tty_reset(tty); 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_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ua); + tty_emulate_repeat(tty, TTYC_IL, TTYC_IL1, ctx->num); } 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; - u_int ua; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; if (wp->xoff != 0 || screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) { @@ -644,21 +637,20 @@ tty_cmd_deleteline(struct tty *tty, struct window_pane *wp, va_list ap) return; } - ua = va_arg(ap, u_int); - tty_reset(tty); 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_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ua); + tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num); } 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; - u_int i; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; + u_int i; tty_reset(tty); @@ -673,11 +665,11 @@ tty_cmd_clearline(struct tty *tty, struct window_pane *wp, unused va_list ap) } void -tty_cmd_clearendofline( - struct tty *tty, struct window_pane *wp, unused va_list ap) +tty_cmd_clearendofline(struct tty *tty, struct tty_ctx *ctx) { - struct screen *s = wp->screen; - u_int i; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; + u_int i; tty_reset(tty); @@ -692,11 +684,11 @@ tty_cmd_clearendofline( } void -tty_cmd_clearstartofline( - struct tty *tty, struct window_pane *wp, unused va_list ap) +tty_cmd_clearstartofline(struct tty *tty, struct tty_ctx *ctx) { - struct screen *s = wp->screen; - u_int i; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; + u_int i; tty_reset(tty); @@ -711,9 +703,10 @@ tty_cmd_clearstartofline( } 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 || !tty_term_has(tty->term, TTYC_CSR)) { @@ -732,9 +725,10 @@ tty_cmd_reverseindex(struct tty *tty, struct window_pane *wp, unused va_list ap) } 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 || !tty_term_has(tty->term, TTYC_CSR)) { @@ -753,11 +747,11 @@ tty_cmd_linefeed(struct tty *tty, struct window_pane *wp, unused va_list ap) } void -tty_cmd_clearendofscreen( - struct tty *tty, struct window_pane *wp, unused va_list ap) +tty_cmd_clearendofscreen(struct tty *tty, struct tty_ctx *ctx) { - struct screen *s = wp->screen; - u_int i, j; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; + u_int i, j; tty_reset(tty); @@ -788,11 +782,11 @@ tty_cmd_clearendofscreen( } void -tty_cmd_clearstartofscreen( - struct tty *tty, struct window_pane *wp, unused va_list ap) +tty_cmd_clearstartofscreen(struct tty *tty, struct tty_ctx *ctx) { - struct screen *s = wp->screen; - u_int i, j; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; + u_int i, j; tty_reset(tty); @@ -817,11 +811,11 @@ tty_cmd_clearstartofscreen( } void -tty_cmd_clearscreen( - struct tty *tty, struct window_pane *wp, unused va_list ap) +tty_cmd_clearscreen(struct tty *tty, struct tty_ctx *ctx) { - struct screen *s = wp->screen; - u_int i, j; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; + u_int i, j; tty_reset(tty); @@ -846,11 +840,11 @@ tty_cmd_clearscreen( } void -tty_cmd_alignmenttest( - struct tty *tty, struct window_pane *wp, unused va_list ap) +tty_cmd_alignmenttest(struct tty *tty, struct tty_ctx *ctx) { - struct screen *s = wp->screen; - u_int i, j; + struct window_pane *wp = ctx->wp; + struct screen *s = wp->screen; + u_int i, j; tty_reset(tty); @@ -864,33 +858,26 @@ tty_cmd_alignmenttest( } 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 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_cell(tty, gc, gu); + tty_cell(tty, ctx->cell, ctx->utf8); } void -tty_cmd_utf8character( - struct tty *tty, unused struct window_pane *wp, va_list ap) +tty_cmd_utf8character(struct tty *tty, struct tty_ctx *ctx) { - u_char *buf; + u_char *ptr = ctx->ptr; size_t i; - buf = va_arg(ap, u_char *); - for (i = 0; i < UTF8_SIZE; i++) { - if (buf[i] == 0xff) + if (ptr[i] == 0xff) break; - tty_putc(tty, buf[i]); + tty_putc(tty, ptr[i]); } }