[bitmap] actually call sprite_sixel_init()

This commit is contained in:
nick black 2021-03-25 21:16:02 -04:00
parent 6f446f94de
commit 83af07546d
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 12 additions and 4 deletions

View File

@ -563,5 +563,5 @@ int sprite_sixel_init(int fd){
// \e[?8452: DECSDM private "sixel scrolling" mode keeps the sixel from
// scrolling, but puts it at the current cursor location (as opposed to
// the upper left corner of the screen).
return tty_emit("\e[?8452h", fd);
return tty_emit("\e[?80;8452h", fd);
}

View File

@ -307,6 +307,7 @@ query_sixel_details(tinfo* ti, int fd){
// query for Sixel support
static int
query_sixel(tinfo* ti, int fd){
int (*pixel_init)(int fd) = NULL;
if(writen(fd, "\x1b[c", 3) != 3){
return -1;
}
@ -347,7 +348,7 @@ query_sixel(tinfo* ti, int fd){
ti->sixel_supported = true;
ti->color_registers = 256; // assumed default [shrug]
ti->pixel_destroy = sprite_sixel_annihilate;
ti->pixel_init = sprite_sixel_init;
pixel_init = ti->pixel_init = sprite_sixel_init;
ti->pixel_cell_wipe = sprite_sixel_cell_wipe;
ti->sixel_maxx = ti->sixel_maxy = 0;
}
@ -361,6 +362,11 @@ query_sixel(tinfo* ti, int fd){
break;
}
}
if(pixel_init){
if(pixel_init(fd)){
return -1;
}
}
return 0; // FIXME return error?
}

View File

@ -293,7 +293,9 @@ int direct_mode_player(int argc, char** argv, ncscale_e scalemode,
}
bool failed = false;
if(blitter == NCBLIT_PIXEL){
dm.check_pixel_support();
if(dm.check_pixel_support() <= 0){
blitter = NCBLIT_DEFAULT;
}
}
for(auto i = 0 ; i < argc ; ++i){
auto faken = dm.prep_image(argv[i], blitter, scalemode, -1,
@ -318,7 +320,7 @@ int direct_mode_player(int argc, char** argv, ncscale_e scalemode,
}
int y, x;
dm.get_cursor_yx(&y, &x);
if(x || (i + 1 < argc && blitter == NCBLIT_PIXEL)){
if(x){
std::cout << std::endl;
}
}