if (term->screen) fix_cpos;
static void swap_screen(Terminal *term, int which, int reset, int keep_cur_pos){    int t;    tree234 *ttr;    if (!which)	reset = FALSE;		       /* do no weird resetting if which==0 */    if (which != term->alt_which) {	term->alt_which = which;	ttr = term->alt_screen;	term->alt_screen = term->screen;	term->screen = ttr;	term->alt_sblines = find_last_nonempty_line(term, term->alt_screen) + 1;	t = term->curs.x;	if (!reset && !keep_cur_pos)	    term->curs.x = term->alt_x;	term->alt_x = t;	t = term->curs.y;	if (!reset && !keep_cur_pos)	    term->curs.y = term->alt_y;	term->alt_y = t;	t = term->marg_t;	if (!reset) term->marg_t = term->alt_t;	term->alt_t = t;	t = term->marg_b;	if (!reset) term->marg_b = term->alt_b;	term->alt_b = t;	t = term->dec_om;	if (!reset) term->dec_om = term->alt_om;	term->alt_om = t;	t = term->wrap;	if (!reset) term->wrap = term->alt_wrap;	term->alt_wrap = t;	t = term->wrapnext;	if (!reset) term->wrapnext = term->alt_wnext;	term->alt_wnext = t;	t = term->insert;	if (!reset) term->insert = term->alt_ins;	term->alt_ins = t;	t = term->cset;	if (!reset) term->cset = term->alt_cset;	term->alt_cset = t;	t = term->utf;	if (!reset) term->utf = term->alt_utf;	term->alt_utf = t;	t = term->sco_acs;	if (!reset) term->sco_acs = term->alt_sco_acs;	term->alt_sco_acs = t;    }    if (reset && term->screen) {	/*	 * Yes, this _is_ supposed to honour background-colour-erase.	 */	erase_lots(term, FALSE, TRUE, TRUE);    }    /*     * This might not be possible if we're called during     * initialisation.     */    if (term->screen)	fix_cpos;}