diff --git a/TERMINALS.md b/TERMINALS.md index 68713c6ed..c017d30f0 100644 --- a/TERMINALS.md +++ b/TERMINALS.md @@ -17,7 +17,8 @@ relies on the font. Patches to correct/complete this table are very welcome! | Terminal | Pixel `TIOCGWINSZ` | `ccc` | Blocks | Recommended environment | Notes | | --------------- | ------------------ | ----- | ------ | ----------------------- | ----- | -| [Alacritty](https://github.com/alacritty/alacritty) | ✅ | ✅ |❌ |`TERM=alacritty` `COLORTERM=24bit` | Sixel support WIP: https://github.com/ayosec/alacritty/tree/graphics | +| [Alacritty](https://github.com/alacritty/alacritty) | ✅ | ✅ |❌ |`TERM=alacritty` `COLORTERM=24bit` | [Sixel support WIP](https://github.com/ayosec/alacritty/tree/graphics) | +| [Contour](https://github.com/christianparpart/contour) | ❌ | ✅ |? |`TERM=contour-latest` ? | Claims Sixel support | | [FBterm](https://github.com/zhangyuanwei/fbterm) | ❌ | ? |? |`TERM=fbterm` | 256 colors, no RGB color. | | [foot](https://codeberg.org/dnkl/foot) | ✅ | ✅ |✅ |`TERM=foot` | Sixel support. | | [Gnome Terminal](https://gitlab.gnome.org/GNOME/gnome-terminal) | | ❌ |✅ |`TERM=gnome` `COLORTERM=24bit` | `ccc` support *is* available when run with `vte-256color`. | diff --git a/src/lib/kitty.c b/src/lib/kitty.c index f6c32274b..5da60b40a 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -291,8 +291,12 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, }else if(tacache[tyx] == SPRIXCELL_OPAQUE){ tacache[tyx] = SPRIXCELL_MIXED; } - }else if(tacache[tyx] == SPRIXCELL_TRANSPARENT){ - tacache[tyx] = SPRIXCELL_MIXED; + }else{ + if(x % cdimx == 0 && y % cdimy == 0){ + tacache[tyx] = SPRIXCELL_OPAQUE; + }else if(tacache[tyx] == SPRIXCELL_TRANSPARENT){ + tacache[tyx] = SPRIXCELL_MIXED; + } } } ++x; diff --git a/src/lib/render.c b/src/lib/render.c index b859f1733..a2f71345c 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -7,7 +7,8 @@ // Check whether the terminal geometry has changed, and if so, copies what can // be copied from the old lastframe. Assumes that the screen is always anchored -// at the same origin. +// at the same origin. Initiates a resize cascade for the pile containing |pp|. +// The current terminal geometry, changed or not, is written to |rows|/|cols|. static int notcurses_resize_internal(ncplane* pp, int* restrict rows, int* restrict cols){ notcurses* n = ncplane_notcurses(pp); @@ -64,6 +65,7 @@ notcurses_resize_internal(ncplane* pp, int* restrict rows, int* restrict cols){ return ret; } +// Check for a window resize on the standard pile. static int notcurses_resize(notcurses* n, int* restrict rows, int* restrict cols){ pthread_mutex_lock(&n->pilelock); @@ -72,6 +74,8 @@ notcurses_resize(notcurses* n, int* restrict rows, int* restrict cols){ return ret; } +// write(2) until we've written it all. Uses poll(2) to avoid spinning on +// EAGAIN, at a small cost of latency. static int blocking_write(int fd, const char* buf, size_t buflen){ //fprintf(stderr, "writing %zu to %d...\n", buflen, fd); @@ -115,6 +119,7 @@ int nccell_duplicate(ncplane* n, nccell* targ, const nccell* c){ return 0; } +// deprecated, goes away in abi3 int cell_duplicate(struct ncplane* n, nccell* targ, const nccell* c){ return nccell_duplicate(n, targ, c); } diff --git a/src/lib/sixel.c b/src/lib/sixel.c index 4e63e1af4..642a44699 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -170,23 +170,25 @@ extract_color_table(const uint32_t* data, int linesize, int cols, for(int sy = visy ; sy < (begy + leny) && sy < visy + 6 ; ++sy){ // offset within sprixel const uint32_t* rgb = (data + (linesize / 4 * sy) + visx); int txyidx = (sy / cdimy) * cols + (visx / cdimx); - if(rgba_trans_p(*rgb, bargs->transcolor)){ - if(tacache[txyidx] == SPRIXCELL_OPAQUE){ - if(sy % cdimy == 0 && visx % cdimx == 0){ - tacache[txyidx] = SPRIXCELL_TRANSPARENT; - }else{ - tacache[txyidx] = SPRIXCELL_MIXED; - } - } - stab->p2 = SIXEL_P2_TRANS; - continue; - }else if(tacache[txyidx] == SPRIXCELL_TRANSPARENT){ - tacache[txyidx] = SPRIXCELL_MIXED; - } if(tacache[txyidx] == SPRIXCELL_ANNIHILATED){ //fprintf(stderr, "TRANS SKIP %d %d %d %d (cell: %d %d)\n", visy, visx, sy, txyidx, sy / cdimy, visx / cdimx); continue; } + if(rgba_trans_p(*rgb, bargs->transcolor)){ + if(sy % cdimy == 0 && visx % cdimx == 0){ + tacache[txyidx] = SPRIXCELL_TRANSPARENT; + }else if(tacache[txyidx] == SPRIXCELL_OPAQUE){ + tacache[txyidx] = SPRIXCELL_MIXED; + } + stab->p2 = SIXEL_P2_TRANS; // even one forces P2=1 + continue; + }else{ + if(sy % cdimy == 0 && visx % cdimx == 0){ + tacache[txyidx] = SPRIXCELL_OPAQUE; + }else if(tacache[txyidx] == SPRIXCELL_TRANSPARENT){ + tacache[txyidx] = SPRIXCELL_MIXED; + } + } unsigned char comps[RGBSIZE]; break_sixel_comps(comps, *rgb, mask); int c = find_color(stab, comps); diff --git a/src/lib/sprite.c b/src/lib/sprite.c index 6c02f7e08..cbcfa4fc4 100644 --- a/src/lib/sprite.c +++ b/src/lib/sprite.c @@ -12,7 +12,7 @@ sprixel_debug(FILE* out, const sprixel* s){ int idx = 0; for(int y = 0 ; y < s->dimy ; ++y){ for(int x = 0 ; x < s->dimx ; ++x){ - fprintf(out, "%d ", s->n->tacache[idx]); + fprintf(out, "%d", s->n->tacache[idx]); ++idx; } fprintf(out, "\n");