mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
There are relatively few arguments to tty_cmd_* functions now, so tidy them up
by using a struct rather than hiding everything with varargs.
This commit is contained in:
parent
5bd72ec629
commit
6a309c53a8
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
18
tmux.h
18
tmux.h
@ -292,6 +292,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,
|
||||
@ -1048,8 +1058,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;
|
||||
@ -1072,7 +1081,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 *,
|
||||
|
48
tty-write.c
48
tty-write.c
@ -18,26 +18,48 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
165
tty.c
165
tty.c
@ -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,
|
||||
@ -545,66 +545,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)) {
|
||||
@ -612,21 +607,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)) {
|
||||
@ -634,21 +627,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);
|
||||
|
||||
@ -663,11 +655,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);
|
||||
|
||||
@ -682,11 +674,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);
|
||||
|
||||
@ -701,9 +693,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)) {
|
||||
@ -722,9 +715,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)) {
|
||||
@ -743,11 +737,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);
|
||||
|
||||
@ -778,11 +772,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);
|
||||
|
||||
@ -807,11 +801,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);
|
||||
|
||||
@ -836,11 +830,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);
|
||||
|
||||
@ -854,33 +848,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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user