diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 20102f82743f7f5a6f012d0020515db7498e0735..f6eb9b82a296ad0c0425e14e051b01f924683104 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -1215,6 +1215,8 @@ int bitmap_movetext(int x, int y, int ex, int ey, int tox, int toy) || ey>cio_textinfo.screenheight || toy>cio_textinfo.screenheight || (toy + height - 1) > cio_textinfo.screenheight + || ex < x + || ey < y ) { return(0); } diff --git a/src/conio/cterm.c b/src/conio/cterm.c index 7238973c4e0a46a4cfd346b8710c8aa8bd019a15..7c52c68ec42e260737efc28c0b718d3f5cda1631 100644 --- a/src/conio/cterm.c +++ b/src/conio/cterm.c @@ -1231,7 +1231,10 @@ dellines(struct cterminal * cterm, int lines) if (x < TERM_MINX || x > TERM_MAXX || y < TERM_MINY || y > TERM_MAXY) return; SCR_XY(&sx, &sy); - MOVETEXT(minx, sy + lines, maxx, maxy, minx, sy); + if ((sy + lines - 1) > maxy) // Delete all the lines... ie: clear screen... + lines = maxy - sy + 1; + if (sy + lines <= maxy) + MOVETEXT(minx, sy + lines, maxx, maxy, minx, sy); for(i = TERM_MAXY - lines + 1; i <= TERM_MAXY; i++) { cterm_gotoxy(cterm, TERM_MINX, i); cterm_clreol(cterm);