Parse out DA features.

This commit is contained in:
nicm 2019-11-28 10:17:22 +00:00
parent bc5881c4d2
commit 08e2828592
2 changed files with 15 additions and 14 deletions

View File

@ -1636,7 +1636,8 @@ screen_write_overwrite(struct screen_write_ctx *ctx, struct grid_cell *gc,
grid_view_get_cell(gd, xx, s->cy, &tmp_gc); grid_view_get_cell(gd, xx, s->cy, &tmp_gc);
if (~tmp_gc.flags & GRID_FLAG_PADDING) if (~tmp_gc.flags & GRID_FLAG_PADDING)
break; break;
log_debug("%s: overwrite at %u,%u", __func__, xx, s->cy); log_debug("%s: overwrite at %u,%u", __func__, xx,
s->cy);
grid_view_set_cell(gd, xx, s->cy, &grid_default_cell); grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
done = 1; done = 1;
} }

View File

@ -1002,8 +1002,8 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
size_t *size) size_t *size)
{ {
struct client *c = tty->client; struct client *c = tty->client;
u_int i, a, b; u_int i, n = 0;
char tmp[64], *endptr; char tmp[64], *endptr, p[32] = { 0 }, *cp, *next;
static const char *types[] = TTY_TYPES; static const char *types[] = TTY_TYPES;
int type; int type;
@ -1035,23 +1035,21 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
*size = 4 + i; *size = 4 + i;
/* Convert version numbers. */ /* Convert version numbers. */
a = strtoul(tmp, &endptr, 10); cp = tmp;
if (*endptr == ';') { while ((next = strsep(&cp, ";")) != NULL) {
b = strtoul(endptr + 1, &endptr, 10); p[n] = strtoul(next, &endptr, 10);
if (*endptr != '\0' && *endptr != ';') if (*endptr != '\0' && *endptr != ';')
b = 0; p[n] = 0;
} else if (*endptr == '\0') n++;
b = 0; }
else
a = b = 0;
/* Store terminal type. */ /* Store terminal type. */
type = TTY_UNKNOWN; type = TTY_UNKNOWN;
switch (a) { switch (p[0]) {
case 1: case 1:
if (b == 2) if (p[1] == 2)
type = TTY_VT100; type = TTY_VT100;
else if (b == 0) else if (p[1] == 0)
type = TTY_VT101; type = TTY_VT101;
break; break;
case 6: case 6:
@ -1070,6 +1068,8 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
type = TTY_VT520; type = TTY_VT520;
break; break;
} }
for (i = 2; i < n; i++)
log_debug("%s: DA feature: %d", c->name, p[i]);
tty_set_type(tty, type); tty_set_type(tty, type);
log_debug("%s: received DA %.*s (%s)", c->name, (int)*size, buf, log_debug("%s: received DA %.*s (%s)", c->name, (int)*size, buf,