mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
allow kitty graphics to be printed on the lowest line, and use C=1 #1733
This commit is contained in:
parent
761ab46f75
commit
da9293fef1
@ -428,6 +428,7 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, int cols,
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
bool scroll = false; // FIXME
|
||||
bool translucent = bargs->flags & NCVISUAL_OPTION_BLEND;
|
||||
int sprixelid = bargs->u.pixel.spx->id;
|
||||
int cdimy = bargs->u.pixel.celldimy;
|
||||
@ -443,8 +444,9 @@ write_kitty_data(FILE* fp, int linesize, int leny, int lenx, int cols,
|
||||
//fprintf(stderr, "total: %d chunks = %d, s=%d,v=%d\n", total, chunks, lenx, leny);
|
||||
while(chunks--){
|
||||
if(totalout == 0){
|
||||
*parse_start = fprintf(fp, "\e_Gf=32,s=%d,v=%d,i=%d,a=T,%c=1;",
|
||||
lenx, leny, sprixelid, chunks ? 'm' : 'q');
|
||||
*parse_start = fprintf(fp, "\e_Gf=32,s=%d,v=%d,i=%d,a=T,%c=1%s;",
|
||||
lenx, leny, sprixelid, chunks ? 'm' : 'q',
|
||||
scroll ? "" : ",C=1");
|
||||
}else{
|
||||
fprintf(fp, "\e_G%sm=%d;", chunks ? "" : "q=2,", chunks ? 1 : 0);
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ setup_sixel_bitmaps(tinfo* ti){
|
||||
|
||||
static inline void
|
||||
setup_kitty_bitmaps(tinfo* ti, int fd){
|
||||
ti->bitmap_supported = true;
|
||||
ti->pixel_wipe = kitty_wipe;
|
||||
ti->pixel_destroy = kitty_destroy;
|
||||
ti->pixel_remove = kitty_remove;
|
||||
@ -29,6 +30,7 @@ setup_kitty_bitmaps(tinfo* ti, int fd){
|
||||
ti->sprixel_scale_height = 1;
|
||||
ti->pixel_rebuild = kitty_rebuild;
|
||||
ti->pixel_clear_all = kitty_clear_all;
|
||||
ti->bitmap_lowest_line = true;
|
||||
set_pixel_blitter(kitty_blit);
|
||||
sprite_init(ti, fd);
|
||||
}
|
||||
@ -91,7 +93,6 @@ apply_term_heuristics(tinfo* ti, const char* termname, int fd){
|
||||
ti->sextants = true; // work since bugfix in 0.19.3
|
||||
ti->quadrants = true;
|
||||
ti->pixel_query_done = true;
|
||||
ti->bitmap_supported = true;
|
||||
ti->RGBflag = true;
|
||||
setup_kitty_bitmaps(ti, fd);
|
||||
}else if(strstr(termname, "alacritty")){
|
||||
|
@ -121,6 +121,7 @@ typedef struct tinfo {
|
||||
struct termios tpreserved; // terminal state upon entry
|
||||
ncinputlayer input; // input layer
|
||||
bool bitmap_supported; // do we support bitmaps (post pixel_query_done)?
|
||||
bool bitmap_lowest_line; // can we render pixels to the bottom row?
|
||||
bool pixel_query_done; // have we yet performed pixel query?
|
||||
bool RGBflag; // "RGB" flag for 24bpc truecolor
|
||||
bool CCCflag; // "CCC" flag for palette set capability
|
||||
|
@ -773,7 +773,10 @@ make_sprixel_plane(notcurses* nc, ncplane* parent, ncvisual* ncv,
|
||||
if(scaling != NCSCALE_NONE && scaling != NCSCALE_NONE_HIRES){
|
||||
ncplane_dim_yx(parent, disppixy, disppixx);
|
||||
if(*placey + *disppixy >= ncplane_dim_y(notcurses_stdplane_const(nc))){
|
||||
*disppixy = ncplane_dim_y(notcurses_stdplane_const(nc)) - *placey - 1;
|
||||
*disppixy = ncplane_dim_y(notcurses_stdplane_const(nc)) - *placey;
|
||||
if(!nc->tcache.bitmap_lowest_line){
|
||||
--*disppixy;
|
||||
}
|
||||
}
|
||||
if(!(flags & NCVISUAL_OPTION_VERALIGNED)){
|
||||
*disppixy -= *placey;
|
||||
|
@ -385,7 +385,7 @@ int rendered_mode_player_inner(NotCurses& nc, int argc, char** argv,
|
||||
// leave a line at the bottom. perhaps one day we'll put information there.
|
||||
// for now, this keeps us from scrolling when we use bitmaps.
|
||||
if(nopts.margin_b == 0){
|
||||
nopts.margin_b = 1;
|
||||
//nopts.margin_b = 1;
|
||||
}
|
||||
nopts.name = "play";
|
||||
nopts.resizecb = ncplane_resize_marginalized;
|
||||
|
Loading…
Reference in New Issue
Block a user