gimme that appsync support #1582

pull/1815/head
nick black 3 years ago committed by Nick Black
parent cb486fef3e
commit 1f19ee3bb1

@ -51,10 +51,11 @@ static void
tinfo_debug_caps(const tinfo* ti, FILE* debugfp, int rows, int cols, tinfo_debug_caps(const tinfo* ti, FILE* debugfp, int rows, int cols,
unsigned images, unsigned videos){ unsigned images, unsigned videos){
const char indent[] = " "; const char indent[] = " ";
fprintf(debugfp, "%scolors: %u rgb: %c ccc: %c setaf: %c setab: %c\n", fprintf(debugfp, "%scolors: %u rgb: %c ccc: %c setaf: %c setab: %c app-sync: %c\n",
indent, ti->caps.colors, capbool(ti->caps.rgb), capbool(ti->caps.can_change_colors), indent, ti->caps.colors, capbool(ti->caps.rgb), capbool(ti->caps.can_change_colors),
capyn(get_escape(ti, ESCAPE_SETAF)), capyn(get_escape(ti, ESCAPE_SETAF)),
capyn(get_escape(ti, ESCAPE_SETAB))); capyn(get_escape(ti, ESCAPE_SETAB)),
capyn(get_escape(ti, ESCAPE_BSU)));
fprintf(debugfp, "%ssgr: %c sgr0: %c op: %c fgop: %c bgop: %c\n", fprintf(debugfp, "%ssgr: %c sgr0: %c op: %c fgop: %c bgop: %c\n",
indent, capyn(get_escape(ti, ESCAPE_SGR)), indent, capyn(get_escape(ti, ESCAPE_SGR)),
capyn(get_escape(ti, ESCAPE_SGR0)), capyn(get_escape(ti, ESCAPE_SGR0)),

@ -646,6 +646,8 @@ typedef enum {
STATE_SIXEL_HEIGHT, // reading maximum sixel height until 'S' STATE_SIXEL_HEIGHT, // reading maximum sixel height until 'S'
STATE_SIXEL_CREGS, // reading max color registers until 'S' STATE_SIXEL_CREGS, // reading max color registers until 'S'
STATE_XTSMGRAPHICS_DRAIN, // drain out XTSMGRAPHICS to 'S' STATE_XTSMGRAPHICS_DRAIN, // drain out XTSMGRAPHICS to 'S'
STATE_APPSYNC_REPORT, // got DECRPT ?2026
STATE_APPSYNC_REPORT_DRAIN, // drain out decrpt to 'y'
} initstates_e; } initstates_e;
typedef struct query_state { typedef struct query_state {
@ -817,7 +819,7 @@ stash_string(query_state* inits){
// ought be fed to the machine, and -1 on an invalid state transition. // ought be fed to the machine, and -1 on an invalid state transition.
static int static int
pump_control_read(query_state* inits, unsigned char c){ pump_control_read(query_state* inits, unsigned char c){
//fprintf(stderr, "state: %2d char: %1c %3d %02x\n", inits->state, isprint(c) ? c : ' ', c, c); fprintf(stderr, "state: %2d char: %1c %3d %02x\n", inits->state, isprint(c) ? c : ' ', c, c);
if(c == NCKEY_ESC){ if(c == NCKEY_ESC){
inits->state = STATE_ESC; inits->state = STATE_ESC;
return 0; return 0;
@ -1006,6 +1008,9 @@ pump_control_read(query_state* inits, unsigned char c){
if(c == '1'){ if(c == '1'){
inits->state = STATE_DA_1; inits->state = STATE_DA_1;
}else if(c == '2'){ }else if(c == '2'){
if(ruts_numeric(&inits->numeric, c)){ // stash for DECRPT
return -1;
}
inits->state = STATE_SIXEL; inits->state = STATE_SIXEL;
}else if(c == '4' || c == '7'){ // VT132, VT131 }else if(c == '4' || c == '7'){ // VT132, VT131
inits->state = STATE_DA_DRAIN; inits->state = STATE_DA_DRAIN;
@ -1065,7 +1070,13 @@ pump_control_read(query_state* inits, unsigned char c){
break; break;
case STATE_SIXEL: case STATE_SIXEL:
if(c == ';'){ if(c == ';'){
inits->state = STATE_SIXEL_SEMI1; if(inits->numeric == 2026){
inits->state = STATE_APPSYNC_REPORT;
}else{
inits->state = STATE_SIXEL_SEMI1;
}
}else if(ruts_numeric(&inits->numeric, c)){
return -1;
}else{ }else{
// FIXME error? // FIXME error?
} }
@ -1108,6 +1119,17 @@ pump_control_read(query_state* inits, unsigned char c){
inits->state = STATE_NULL; inits->state = STATE_NULL;
} }
break; break;
case STATE_APPSYNC_REPORT:
if(c == '2'){
inits->appsync = 1;
inits->state = STATE_APPSYNC_REPORT_DRAIN;
}
break;
case STATE_APPSYNC_REPORT_DRAIN:
if(c == 'y'){
inits->state = STATE_NULL;
}
break;
default: default:
fprintf(stderr, "Reached invalid init state %d\n", inits->state); fprintf(stderr, "Reached invalid init state %d\n", inits->state);
return -1; return -1;

@ -288,7 +288,7 @@ apply_term_heuristics(tinfo* ti, const char* termname, int fd,
static int static int
send_initial_queries(int fd){ send_initial_queries(int fd){
const char queries[] = CSI_BGQ const char queries[] = CSI_BGQ
"\x1b[?2026$p" // App-Sync Update support "\x1b[?2026$p" // query for App-sync updates
"\x1b[=0c" // Tertiary Device Attributes "\x1b[=0c" // Tertiary Device Attributes
"\x1b[>0q" // XTVERSION "\x1b[>0q" // XTVERSION
"\x1bP+q544e\x1b\\" // XTGETTCAP['TN'] "\x1bP+q544e\x1b\\" // XTGETTCAP['TN']

Loading…
Cancel
Save