[kitty] fix default background workaround, erp

pull/2236/head
nick black 3 years ago
parent dd2e5929e3
commit 6fa901c4b1
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -338,9 +338,13 @@ display_logo(struct ncplane* n, const char* path){
static void
tinfo_debug_bitmaps(struct ncplane* n, const tinfo* ti, const char* indent){
if(!(ti->bg_collides_default & 0x80000000)){
ncplane_printf(n, "%sdefault background 0x%06lx %sconsidered transparent", indent,
ti->bg_collides_default & 0xfffffful,
(ti->bg_collides_default & 0x01000000) ? "" : "not ");
if(!(ti->bg_collides_default & 0x01000000)){
ncplane_printf(n, "%sdefault background 0x%06lx", indent,
ti->bg_collides_default & 0xfffffful);
}else{
ncplane_printf(n, "%sdefault background 0x%06lx considered transparent", indent,
ti->bg_collides_default & 0xfffffful);
}
}else{
ncplane_printf(n, "couldn't detect default background");
}

@ -850,7 +850,7 @@ build_cflow_automaton(inputctx* ictx){
{ "[?2;3;0S", NULL, }, // negative pixels XTSMGRAPHICS
{ "[?1;0;\\NS", xtsmgraphics_cregs_cb, },
{ "[?2;0;\\N;\\NS", xtsmgraphics_sixel_cb, },
{ "[>\\N;\\N;\\Nc", da2_cb, }, // "VT100"
{ "[>\\N;\\N;\\Nc", da2_cb, },
{ "[=\\Sc", da3_cb, }, // CSI da3 form as issued by WezTerm
// DCS (\eP...ST)
{ "P1+r\\S", tcap_cb, }, // positive XTGETTCAP

@ -693,14 +693,12 @@ term_bg_rgb8(const tinfo* ti, fbuf* f, unsigned r, unsigned g, unsigned b){
// If it doesn't work, eh, it doesn't work. Fuck the world; save yourself.
if(ti->caps.rgb){
if((ti->bg_collides_default & 0xff000000) == 0x01000000){
if((r == (ti->bg_collides_default & 0xff0000lu)) &&
(g == (ti->bg_collides_default & 0xff00lu)) &&
(b == (ti->bg_collides_default & 0xfflu))){
if(b < 255){
++b;
}else{
--b;
}
if((r == ncchannel_r(ti->bg_collides_default)) &&
(g == ncchannel_g(ti->bg_collides_default)) &&
(b == ncchannel_b(ti->bg_collides_default))){
// the human eye has fewer blue cones than red or green. toggle
// the last bit in the blue component to avoid a collision.
b ^= 0x00000001;
}
}
return term_esc_rgb(f, false, r, g, b);

Loading…
Cancel
Save