clp->in_ex = 1; F_SET(clp, CL_SCR_EX_INIT);
F_SET(clp, CL_IN_EX | CL_SCR_EX_INIT);
cl_screen(sp, flags)	SCR *sp;	u_int32_t flags;{	CL_PRIVATE *clp;	GS *gp;	gp = sp->gp;	clp = CLP(sp);	/* See if the current information is incorrect. */	if (F_ISSET(gp, G_SRESTART)) {		if (cl_quit(gp))			return (1);		F_CLR(gp, G_SRESTART);	}		/* See if we're already in the right mode. */	if (LF_ISSET(SC_EX) && F_ISSET(sp, SC_SCR_EX) ||	    LF_ISSET(SC_VI) && F_ISSET(sp, SC_SCR_VI))		return (0);	/*	 * Fake leaving ex mode.	 *	 * We don't actually exit ex or vi mode unless forced (e.g. by a window	 * size change).  This is because many curses implementations can't be	 * called twice in a single program.  Plus, it's faster.  If the editor	 * "leaves" vi to enter ex, when it exits ex we'll just fall back into	 * vi.	 */	if (F_ISSET(sp, SC_SCR_EX))		F_CLR(sp, SC_SCR_EX);	/*	 * Fake leaving vi mode.	 *	 * Clear out the rest of the screen if we're in the middle of a split	 * screen.  Move to the last line in the current screen -- this makes	 * terminal scrolling happen naturally.  Note: *don't* move past the	 * end of the screen, as there are ex commands (e.g., :read ! cat file)	 * that don't want to.  Don't clear the info line, its contents may be	 * valid, e.g. :file|append.	 */	if (F_ISSET(sp, SC_SCR_VI)) {		F_CLR(sp, SC_SCR_VI);		if (sp->q.cqe_next != (void *)&gp->dq) {			(void)move(RLNO(sp, sp->rows), 0);			clrtobot();		}		(void)move(RLNO(sp, sp->rows) - 1, 0);		refresh();	}	/* Enter the requested mode. */	if (LF_ISSET(SC_EX)) {		if (cl_ex_init(sp))			return (1);		clp->in_ex = 1;		F_SET(clp, CL_SCR_EX_INIT);		/*		 * If doing an ex screen for ex mode, move to the last line		 * on the screen.		 */		if (F_ISSET(sp, SC_EX) && clp->cup != NULL)			tputs(tgoto(clp->cup,			    0, O_VAL(sp, O_LINES) - 1), 1, cl_putchar);	} else {		if (cl_vi_init(sp))			return (1);		clp->in_ex = 0;		F_SET(clp, CL_SCR_VI_INIT);	}	return (0);}