From 83af07546d6f268a8d9ea1917b19353b536308fd Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 25 Mar 2021 21:16:02 -0400 Subject: [PATCH] [bitmap] actually call sprite_sixel_init() --- src/lib/sixel.c | 2 +- src/lib/terminfo.c | 8 +++++++- src/player/play.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/sixel.c b/src/lib/sixel.c index 1afca09c5..7aeeaa194 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -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); } diff --git a/src/lib/terminfo.c b/src/lib/terminfo.c index 66c753da9..855626f32 100644 --- a/src/lib/terminfo.c +++ b/src/lib/terminfo.c @@ -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? } diff --git a/src/player/play.cpp b/src/player/play.cpp index 51d2b95f4..f3fdf7206 100644 --- a/src/player/play.cpp +++ b/src/player/play.cpp @@ -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; } }