mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Implement the DEC alignment test. With the last change this is enough for the
first cursor test in vttest (in ports) to pass; it still shops a few more problems though.
This commit is contained in:
parent
ebe07c2726
commit
52ec9b9ec4
27
input.c
27
input.c
@ -630,6 +630,9 @@ input_handle_c1_control(u_char ch, struct input_ctx *ictx)
|
||||
log_debug2("-- c1 %zu: %hhu (%c)", ictx->off, ch, ch);
|
||||
|
||||
switch (ch) {
|
||||
case 'D': /* IND */
|
||||
screen_write_linefeed(&ictx->ctx);
|
||||
break;
|
||||
case 'E': /* NEL */
|
||||
screen_write_carriagereturn(&ictx->ctx);
|
||||
screen_write_linefeed(&ictx->ctx);
|
||||
@ -652,7 +655,7 @@ input_handle_private_two(u_char ch, struct input_ctx *ictx)
|
||||
"-- p2 %zu: %hhu (%c) %hhu", ictx->off, ch, ch, ictx->intermediate);
|
||||
|
||||
switch (ch) {
|
||||
case '0': /* Dscs (graphics) */
|
||||
case '0': /* SCS */
|
||||
/*
|
||||
* Not really supported, but fake it up enough for those that
|
||||
* use it to switch character sets (by redefining G0 to
|
||||
@ -665,22 +668,36 @@ input_handle_private_two(u_char ch, struct input_ctx *ictx)
|
||||
}
|
||||
break;
|
||||
case '=': /* DECKPAM */
|
||||
if (ictx->intermediate != '\0')
|
||||
break;
|
||||
screen_write_kkeypadmode(&ictx->ctx, 1);
|
||||
log_debug("kkeypad on (application mode)");
|
||||
break;
|
||||
case '>': /* DECKPNM */
|
||||
if (ictx->intermediate != '\0')
|
||||
break;
|
||||
screen_write_kkeypadmode(&ictx->ctx, 0);
|
||||
log_debug("kkeypad off (number mode)");
|
||||
break;
|
||||
case '7': /* DECSC */
|
||||
if (ictx->intermediate != '\0')
|
||||
break;
|
||||
memcpy(&ictx->saved_cell, &ictx->cell, sizeof ictx->saved_cell);
|
||||
ictx->saved_cx = s->cx;
|
||||
ictx->saved_cy = s->cy;
|
||||
break;
|
||||
case '8': /* DECRC */
|
||||
memcpy(&ictx->cell, &ictx->saved_cell, sizeof ictx->cell);
|
||||
screen_write_cursormove(
|
||||
&ictx->ctx, ictx->saved_cx, ictx->saved_cy);
|
||||
case '8':
|
||||
switch (ictx->intermediate) {
|
||||
case '\0': /* DECRC */
|
||||
memcpy(
|
||||
&ictx->cell, &ictx->saved_cell, sizeof ictx->cell);
|
||||
screen_write_cursormove(
|
||||
&ictx->ctx, ictx->saved_cx, ictx->saved_cy);
|
||||
break;
|
||||
case '#': /* DECALN */
|
||||
screen_write_alignmenttest(&ictx->ctx);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log_debug("unknown p2: %hhu", ch);
|
||||
|
@ -291,6 +291,31 @@ screen_write_cursorleft(struct screen_write_ctx *ctx, u_int nx)
|
||||
s->cx -= nx;
|
||||
}
|
||||
|
||||
/* VT100 alignment test. */
|
||||
void
|
||||
screen_write_alignmenttest(struct screen_write_ctx *ctx)
|
||||
{
|
||||
struct screen *s = ctx->s;
|
||||
struct grid_cell gc;
|
||||
u_int xx, yy;
|
||||
|
||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||
gc.data = 'E';
|
||||
|
||||
for (yy = 0; yy < screen_size_y(s); yy++) {
|
||||
for (xx = 0; xx < screen_size_x(s); xx++)
|
||||
grid_view_set_cell(s->grid, xx, yy, &gc);
|
||||
}
|
||||
|
||||
s->cx = 0;
|
||||
s->cy = 0;
|
||||
|
||||
s->rupper = 0;
|
||||
s->rlower = screen_size_y(s) - 1;
|
||||
|
||||
tty_write_cmd(ctx->wp, TTY_ALIGNMENTTEST);
|
||||
}
|
||||
|
||||
/* Insert nx characters. */
|
||||
void
|
||||
screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx)
|
||||
|
2
tmux.h
2
tmux.h
@ -279,6 +279,7 @@ struct tty_term_code_entry {
|
||||
|
||||
/* Output commands. */
|
||||
enum tty_cmd {
|
||||
TTY_ALIGNMENTTEST,
|
||||
TTY_CELL,
|
||||
TTY_CLEARENDOFLINE,
|
||||
TTY_CLEARENDOFSCREEN,
|
||||
@ -1363,6 +1364,7 @@ void screen_write_cursorup(struct screen_write_ctx *, u_int);
|
||||
void screen_write_cursordown(struct screen_write_ctx *, u_int);
|
||||
void screen_write_cursorright(struct screen_write_ctx *, u_int);
|
||||
void screen_write_cursorleft(struct screen_write_ctx *, u_int);
|
||||
void screen_write_alignmenttest(struct screen_write_ctx *);
|
||||
void screen_write_insertcharacter(struct screen_write_ctx *, u_int);
|
||||
void screen_write_deletecharacter(struct screen_write_ctx *, u_int);
|
||||
void screen_write_insertline(struct screen_write_ctx *, u_int);
|
||||
|
20
tty.c
20
tty.c
@ -38,6 +38,7 @@ 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);
|
||||
@ -54,6 +55,7 @@ void tty_cmd_raw(struct tty *, struct window_pane *, va_list);
|
||||
void tty_cmd_reverseindex(struct tty *, struct window_pane *, va_list);
|
||||
|
||||
void (*tty_cmds[])(struct tty *, struct window_pane *, va_list) = {
|
||||
tty_cmd_alignmenttest,
|
||||
tty_cmd_cell,
|
||||
tty_cmd_clearendofline,
|
||||
tty_cmd_clearendofscreen,
|
||||
@ -830,6 +832,24 @@ tty_cmd_clearscreen(
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_cmd_alignmenttest(
|
||||
struct tty *tty, struct window_pane *wp, unused va_list ap)
|
||||
{
|
||||
struct screen *s = wp->screen;
|
||||
u_int i, j;
|
||||
|
||||
tty_reset(tty);
|
||||
|
||||
tty_region(tty, 0, screen_size_y(s) - 1, wp->yoff);
|
||||
|
||||
for (j = 0; j < screen_size_y(s); j++) {
|
||||
tty_cursor(tty, 0, j, wp->xoff, wp->yoff);
|
||||
for (i = 0; i < screen_size_x(s); i++)
|
||||
tty_putc(tty, 'E');
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_cmd_cell(struct tty *tty, struct window_pane *wp, va_list ap)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user