* Since we're going to scroll the whole screen upwards, * let's also affect the scrollback buffer.
* Since we're going to scroll the top line and we're on the * scrolling screen let's also affect the scrollback buffer.
static void scroll (int topline, int botline, int lines, int sb) {    unsigned long *scroll_top;    int scroll_size, size, i;    scroll_top = scrtop + topline*(cols+1);    size = (lines < 0 ? -lines : lines) * (cols+1);    scroll_size = (botline - topline + 1) * (cols+1) - size;    if (lines > 0 && topline == 0 && botline == (rows-1) && sb) {	/*	 * Since we're going to scroll the whole screen upwards,	 * let's also affect the scrollback buffer.	 */	sbtop -= lines * (cols+1);	if (sbtop < text)	    sbtop = text;	scroll_size += scroll_top - sbtop;	scroll_top = sbtop;	update_sbar();    }    if (scroll_size < 0) {	size += scroll_size;	scroll_size = 0;    }    if (lines > 0) {	if (scroll_size)	    memmove (scroll_top, scroll_top + size, scroll_size*TSIZE);	for (i = 0; i < size; i++)	    scroll_top[i+scroll_size] = ERASE_CHAR;	if (selstart > scroll_top &&	    selstart < scroll_top + size + scroll_size) {	    selstart -= size;	    if (selstart < scroll_top)		selstart = scroll_top;	}	if (selend > scroll_top &&	    selend < scroll_top + size + scroll_size) {	    selend -= size;	    if (selend < scroll_top)		selend = scroll_top;	}    } else {	if (scroll_size)	    memmove (scroll_top + size, scroll_top, scroll_size*TSIZE);	for (i = 0; i < size; i++)	    scroll_top[i] = ERASE_CHAR;	if (selstart > scroll_top &&	    selstart < scroll_top + size + scroll_size) {	    selstart += size;	    if (selstart > scroll_top + size + scroll_size)		selstart = scroll_top + size + scroll_size;	}	if (selend > scroll_top &&	    selend < scroll_top + size + scroll_size) {	    selend += size;	    if (selend > scroll_top + size + scroll_size)		selend = scroll_top + size + scroll_size;	}    }    scroll_heuristic += lines;}