From 6b0845deda46c8530f0442aafe64bba6a56e8773 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Fri, 9 Feb 2018 04:52:14 +0000 Subject: [PATCH] Add CSI < Ps c command to query extended device attributes. Sixel support, loadable fonts, etc. --- src/conio/cterm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/conio/cterm.c b/src/conio/cterm.c index 071be82b2e..0adbce1eaf 100644 --- a/src/conio/cterm.c +++ b/src/conio/cterm.c @@ -1543,6 +1543,34 @@ static void do_ansi(struct cterminal *cterm, char *retbuf, size_t retsize, int * } } break; + case 'c': + /* SyncTERM Device Attributes */ + if (seq->param_str[0] == '<' && parse_parameters(seq)) { + seq_default(seq, 0, 0); + tmp[0] = 0; + for (i=0; i<seq->param_count; i++) { + switch (seq->param_int[i]) { + case 0: /* Advanced features */ + strcpy(tmp, "\x1b[<0"); + if (cio_api.options & CONIO_OPT_LOADABLE_FONTS) + strcat(tmp, ";1"); + if (cio_api.options & CONIO_OPT_BRIGHT_BACKGROUND) + strcat(tmp, ";2"); + if (cio_api.options & CONIO_OPT_PALETTE_SETTING) + strcat(tmp, ";3"); + if (cio_api.options & CONIO_OPT_SET_PIXEL) + strcat(tmp, ";4"); + if (cio_api.options & CONIO_OPT_FONT_SELECT) + strcat(tmp, ";5"); + if (cio_api.options & CONIO_OPT_EXTENDED_PALETTE) + strcat(tmp, ";6"); + strcat(tmp, "n"); + } + } + if(*tmp && strlen(retbuf) + strlen(tmp) < retsize) + strcat(retbuf, tmp); + } + break; case 'h': if (seq->param_str[0] == '?' && parse_parameters(seq)) { attr2palette(cterm->attr, &oldfg, &oldbg); -- GitLab