detect rectangular edit support, display in notcurses-info #2498

pull/2500/head
nick black 2 years ago
parent 406abe53aa
commit dc4bb1095e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -45,7 +45,6 @@ The next five lines describe properties of the terminal environment:
* af: Foreground color can be set
* ab: Background color can be set
* sum: Synchronized Update Mode is supported
* cup: Arbitrary cursor moves
* vpa: Cursor can be moved to an absolute vertical coordinate
* hpa: Cursor can be moved to an absolute horizontal coordinate
* sgr0: Styling can be reset via a single escape
@ -53,6 +52,7 @@ The next five lines describe properties of the terminal environment:
* fgop: Foreground can be reset via a single escape
* bgop: Background can be reset via a single escape
* bce: The back-color-erase property is in play
* rect: Rectangular editing is available
* The second line is more of the same:
* bold: Boldface is available
@ -75,9 +75,11 @@ The next five lines describe properties of the terminal environment:
* vid: Video can be decoded
* indn: Multiple-line scrolling is available
* gpm: Connection is established to the GPM server
* kbd: The Kitty keyboard protocol is in use
* The fourth line indicates the default background color, and whether that
color is treated as transparent.
color is treated as transparent by the terminal (only **kitty** is known
to do this), and the default foreground color.
* The fifth line describes the available bitmap graphics. If Sixels are
available, the maximum number of color registers and maximum Sixel
@ -86,6 +88,9 @@ The next five lines describe properties of the terminal environment:
with "rgba graphics are available"; if Kitty's animation support is also
present, that will be reported with "rgba pixel animation support".
To the right of this material is the Notcurses homepage's URI, and the
Notcurses logo (the latter only if bitmap graphics are available).
The final eleven lines, only printed when in a UTF8 locale, show various
Unicode glyphs. The first four lines include the quadrant, sextant, and
box-drawing characters. The next four lines include the entire Braille set.

@ -422,7 +422,6 @@ tinfo_debug_caps(struct ncplane* n, const tinfo* ti, const char* indent){
tinfo_debug_cap(n, "af", get_escape(ti, ESCAPE_SETAF));
tinfo_debug_cap(n, "ab", get_escape(ti, ESCAPE_SETAB));
tinfo_debug_cap(n, "sum", get_escape(ti, ESCAPE_BSUM));
tinfo_debug_cap(n, "cup", get_escape(ti, ESCAPE_CUP));
tinfo_debug_cap(n, "vpa", get_escape(ti, ESCAPE_VPA));
tinfo_debug_cap(n, "hpa", get_escape(ti, ESCAPE_HPA));
tinfo_debug_cap(n, "sgr0", get_escape(ti, ESCAPE_SGR0));
@ -430,6 +429,7 @@ tinfo_debug_caps(struct ncplane* n, const tinfo* ti, const char* indent){
tinfo_debug_cap(n, "fgop", get_escape(ti, ESCAPE_FGOP));
tinfo_debug_cap(n, "bgop", get_escape(ti, ESCAPE_BGOP));
tinfo_debug_cap(n, "bce", ti->bce);
tinfo_debug_cap(n, "rect", get_escape(ti, ESCAPE_DECERA));
finish_line(n);
}

@ -1082,6 +1082,8 @@ da1_attrs_cb(inputctx* ictx){
if(ictx->initdata->color_registers <= 0){
ictx->initdata->color_registers = 256;
}
}else if(curattr == 28){
ictx->initdata->rectangular_edits = true;
}
curattr = 0;
}
@ -1091,6 +1093,8 @@ da1_attrs_cb(inputctx* ictx){
if(ictx->initdata->color_registers <= 0){
ictx->initdata->color_registers = 256;
}
}else if(curattr == 28){
ictx->initdata->rectangular_edits = true;
}
if(!foundsixel){
scrub_sixel_responses(ictx->initdata);

@ -66,6 +66,7 @@ struct initial_responses {
bool got_bg; // have we read default background?
bool got_fg; // have we read default foreground?
bool rgb; // was RGB DirectColor advertised?
bool rectangular_edits; // were rectangular edits advertised?
int pixx; // screen geometry in pixels
int pixy; // screen geometry in pixels
int dimx; // screen geometry in cells

@ -1327,6 +1327,11 @@ int interrogate_terminfo(tinfo* ti, FILE* out, unsigned utf8,
ti->sixel_maxy = iresp->sixely;
ti->sixel_maxx = iresp->sixelx;
}
if(iresp->rectangular_edits){
if(grow_esc_table(ti, "\x1b[6n", ESCAPE_DECERA, &tablelen, &tableused)){
goto err;
}
}
free(iresp);
if(nocbreak){
// FIXME do this in input later, upon signaling completion?

@ -84,6 +84,7 @@ typedef enum {
ESCAPE_ESUM, // End Synchronized Update Mode
ESCAPE_SAVECOLORS, // XTPUSHCOLORS (push palette/fg/bg)
ESCAPE_RESTORECOLORS, // XTPOPCOLORS (pop palette/fg/bg)
ESCAPE_DECERA, // rectangular erase
ESCAPE_MAX
} escape_e;

Loading…
Cancel
Save