From d991f3c15f687e9d08e6f5d23f6e12d604ac2888 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Fri, 2 Feb 2018 08:39:24 +0000 Subject: [PATCH] Make Sixel drawings scroll the screen. There's an issue with cursor not being cleared from the new position now though... I thought I fixed all of those cases years ago. :( --- src/conio/bitmap_con.c | 1 - src/conio/cterm.c | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 45e235e1b0..aca70a59db 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -441,7 +441,6 @@ int bitmap_movetext(int x, int y, int ex, int ey, int tox, int toy) ssourcepos=((y-1)*vstat.charheight+screeny)*cio_textinfo.screenwidth*vstat.charwidth+(x-1)*vstat.charwidth; memmove(&(screen[ssourcepos+sdestoffset]), &(screen[ssourcepos]), sizeof(screen[0])*width*vstat.charwidth); } - bitmap_draw_cursor(&vstat); unlock_vmem(vmem_ptr); pthread_mutex_unlock(&screenlock); diff --git a/src/conio/cterm.c b/src/conio/cterm.c index f6abeffb7a..d478d9eca8 100644 --- a/src/conio/cterm.c +++ b/src/conio/cterm.c @@ -1278,8 +1278,8 @@ void draw_sixel(struct cterminal *cterm, char *str) struct text_info ti; int i; char *p; + int max_row; - SETCURSORTYPE(_NOCURSOR); GETTEXTINFO(&ti); vmode = find_vmode(ti.currmode); attr2palette(ti.attribute, &fg, &bg); @@ -1378,9 +1378,16 @@ void draw_sixel(struct cterminal *cterm, char *str) p++; break; case '-': // Graphics New Line + max_row = cterm->height; + if(cterm->origin_mode) + max_row = cterm->bottom_margin - cterm->top_margin + 1; + x = left; y += 6; - /* Check y */ + if (y + 5 >= (cterm->y + max_row - 1) * vparams[vmode].charheight) { + scrollup(cterm); + y -= vparams[vmode].charheight; + } p++; break; default: @@ -1388,15 +1395,16 @@ void draw_sixel(struct cterminal *cterm, char *str) } } } + x = x / vparams[vmode].charwidth + 1; - x -= cterm->x; + x -= (cterm->x - 1); x++; y = y / vparams[vmode].charheight + 1; - y -= cterm->y; + y -= (cterm->y - 1); y++; + GOTOXY(x,y); - SETCURSORTYPE(cterm->cursor); } static void do_ansi(struct cterminal *cterm, char *retbuf, size_t retsize, int *speed) -- GitLab