Tweak previous to set and log the feature instead of just setting the

flag.
This commit is contained in:
nicm 2022-11-11 08:44:11 +00:00
parent fe475bd856
commit 20da167377
3 changed files with 20 additions and 14 deletions

View File

@ -343,7 +343,7 @@ static const char *const tty_feature_sixel_capabilities[] = {
static const struct tty_feature tty_feature_sixel = { static const struct tty_feature tty_feature_sixel = {
"sixel", "sixel",
tty_feature_sixel_capabilities, tty_feature_sixel_capabilities,
0 TERM_SIXEL
}; };
/* Available terminal features. */ /* Available terminal features. */

View File

@ -1256,6 +1256,7 @@ 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;
int *features = &c->term_features;
u_int i, n = 0; u_int i, n = 0;
char tmp[128], *endptr, p[32] = { 0 }, *cp, *next; char tmp[128], *endptr, p[32] = { 0 }, *cp, *next;
@ -1308,7 +1309,7 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
for (i = 1; i < n; i++) { for (i = 1; i < n; i++) {
log_debug("%s: DA feature: %d", c->name, p[i]); log_debug("%s: DA feature: %d", c->name, p[i]);
if (p[i] == 4) if (p[i] == 4)
tty->term->flags |= TERM_SIXEL; tty_add_features(features, "sixel", ",");
} }
break; break;
} }
@ -1329,6 +1330,7 @@ tty_keys_device_attributes2(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;
int *features = &c->term_features;
u_int i, n = 0; u_int i, n = 0;
char tmp[128], *endptr, p[32] = { 0 }, *cp, *next; char tmp[128], *endptr, p[32] = { 0 }, *cp, *next;
@ -1376,16 +1378,16 @@ tty_keys_device_attributes2(struct tty *tty, const char *buf, size_t len,
/* Add terminal features. */ /* Add terminal features. */
switch (p[0]) { switch (p[0]) {
case 41: /* VT420 */ case 41: /* VT420 */
tty_add_features(&c->term_features, "margins,rectfill", ","); tty_add_features(features, "margins,rectfill", ",");
break; break;
case 'M': /* mintty */ case 'M': /* mintty */
tty_default_features(&c->term_features, "mintty", 0); tty_default_features(features, "mintty", 0);
break; break;
case 'T': /* tmux */ case 'T': /* tmux */
tty_default_features(&c->term_features, "tmux", 0); tty_default_features(features, "tmux", 0);
break; break;
case 'U': /* rxvt-unicode */ case 'U': /* rxvt-unicode */
tty_default_features(&c->term_features, "rxvt-unicode", 0); tty_default_features(features, "rxvt-unicode", 0);
break; break;
} }
log_debug("%s: received secondary DA %.*s", c->name, (int)*size, buf); log_debug("%s: received secondary DA %.*s", c->name, (int)*size, buf);
@ -1405,6 +1407,7 @@ tty_keys_extended_device_attributes(struct tty *tty, const char *buf,
size_t len, size_t *size) size_t len, size_t *size)
{ {
struct client *c = tty->client; struct client *c = tty->client;
int *features = &c->term_features;
u_int i; u_int i;
char tmp[128]; char tmp[128];
@ -1445,13 +1448,13 @@ tty_keys_extended_device_attributes(struct tty *tty, const char *buf,
/* Add terminal features. */ /* Add terminal features. */
if (strncmp(tmp, "iTerm2 ", 7) == 0) if (strncmp(tmp, "iTerm2 ", 7) == 0)
tty_default_features(&c->term_features, "iTerm2", 0); tty_default_features(features, "iTerm2", 0);
else if (strncmp(tmp, "tmux ", 5) == 0) else if (strncmp(tmp, "tmux ", 5) == 0)
tty_default_features(&c->term_features, "tmux", 0); tty_default_features(features, "tmux", 0);
else if (strncmp(tmp, "XTerm(", 6) == 0) else if (strncmp(tmp, "XTerm(", 6) == 0)
tty_default_features(&c->term_features, "XTerm", 0); tty_default_features(features, "XTerm", 0);
else if (strncmp(tmp, "mintty ", 7) == 0) else if (strncmp(tmp, "mintty ", 7) == 0)
tty_default_features(&c->term_features, "mintty", 0); tty_default_features(features, "mintty", 0);
log_debug("%s: received extended DA %.*s", c->name, (int)*size, buf); log_debug("%s: received extended DA %.*s", c->name, (int)*size, buf);
free(c->term_type); free(c->term_type);

View File

@ -454,6 +454,9 @@ tty_term_apply_overrides(struct tty_term *term)
a = options_array_next(a); a = options_array_next(a);
} }
/* Log the SIXEL flag. */
log_debug("SIXEL flag is %d", !!(term->flags & TERM_SIXEL));
/* Update the RGB flag if the terminal has RGB colours. */ /* Update the RGB flag if the terminal has RGB colours. */
if (tty_term_has(term, TTYC_SETRGBF) && if (tty_term_has(term, TTYC_SETRGBF) &&
tty_term_has(term, TTYC_SETRGBB)) tty_term_has(term, TTYC_SETRGBB))