newalt[i] = ERASE_CHAR;
newalt[i] = erase_char;
void term_size(int newrows, int newcols, int newsavelines) {    unsigned long *newtext, *newdisp, *newwant, *newalt;    int i, j, crows, ccols;    int save_alt_which = alt_which;    if (newrows == rows && newcols == cols && newsavelines == savelines)	return;			       /* nothing to do */    deselect();    swap_screen(0);    alt_t = marg_t = 0;    alt_b = marg_b = newrows - 1;    newtext = smalloc ((newrows+newsavelines)*(newcols+1)*TSIZE);    disptop = newtext + newsavelines*(newcols+1);    for (i=0; i<(newrows+newsavelines)*(newcols+1); i++)	newtext[i] = ERASE_CHAR;    if (rows != -1) {	crows = rows + (scrtop - sbtop) / (cols+1);	if (crows > newrows+newsavelines)	    crows = newrows+newsavelines;	ccols = (cols < newcols ? cols : newcols);	for (i=0; i<crows; i++) {	    int oldidx = (rows + savelines - crows + i) * (cols+1);	    int newidx = (newrows + newsavelines - crows + i) * (newcols+1);	    for (j=0; j<ccols; j++)		newtext[newidx+j] = text[oldidx+j];	    newtext[newidx+newcols] =		(cols == newcols ? text[oldidx+cols] : 0);	}	sbtop = disptop - (crows - newrows) * (newcols+1);	if (sbtop > disptop)	    sbtop = disptop;    } else	sbtop = disptop;    scrtop = disptop;    sfree (text);    text = newtext;    newdisp = smalloc (newrows*(newcols+1)*TSIZE);    for (i=0; i<newrows*(newcols+1); i++)	newdisp[i] = ATTR_INVALID;    sfree (disptext);    disptext = newdisp;    newwant = smalloc (newrows*(newcols+1)*TSIZE);    for (i=0; i<newrows*(newcols+1); i++)	newwant[i] = ATTR_INVALID;    sfree (wanttext);    wanttext = newwant;    newalt = smalloc (newrows*(newcols+1)*TSIZE);    for (i=0; i<newrows*(newcols+1); i++)	newalt[i] = ERASE_CHAR;    sfree (alttext);    alttext = newalt;    sfree (selspace);    selspace = smalloc ( (newrows+newsavelines) * (newcols+sizeof(sel_nl)) );    tabs = srealloc (tabs, newcols*sizeof(*tabs));    {	int i;	for (i = (cols > 0 ? cols : 0); i < newcols; i++)	    tabs[i] = (i % 8 == 0 ? TRUE : FALSE);    }    if (rows > 0)	curs_y += newrows - rows;    if (curs_y < 0)	curs_y = 0;    if (curs_y >= newrows)	curs_y = newrows-1;    if (curs_x >= newcols)	curs_x = newcols-1;    alt_x = alt_y = 0;    wrapnext = alt_wnext = FALSE;    rows = newrows;    cols = newcols;    savelines = newsavelines;    fix_cpos;    swap_screen(save_alt_which);    update_sbar();    term_update();}