* 2: Paint any missing status lines. * * XXX * This is fairly evil.  Status lines are written using the vi message * mechanism, since we have no idea how long they are.  Since we may be * painting screens other than the current one, we don't want to make * the user wait.  We depend heavily on there not being any other lines * currently waiting to be displayed and the message truncation code in * the msgq_status routine working. */ for (tsp = sp->gp->dq.cqh_first; tsp != (void *)&sp->gp->dq; tsp = tsp->q.cqe_next) if (F_ISSET(tsp, SC_STATUS)) vs_resolve(tsp, 0);
* 2: Related or dirtied screens, or screens with messages.
vs_refresh(sp, forcepaint)	SCR *sp;	int forcepaint;{	SCR *tsp;	u_int priv_paint, pub_paint;	/*	 * 1: Refresh the screen.	 *	 * If SC_SCR_REDRAW is set in the current screen, repaint everything	 * that we can find, including status lines.	 */	if (F_ISSET(sp, SC_SCR_REDRAW))		for (tsp = sp->gp->dq.cqh_first;		    tsp != (void *)&sp->gp->dq; tsp = tsp->q.cqe_next)			if (tsp != sp)				F_SET(tsp, SC_SCR_REDRAW | SC_STATUS);	/*	 * 2: Paint any missing status lines.	 *	 * XXX	 * This is fairly evil.  Status lines are written using the vi message	 * mechanism, since we have no idea how long they are.  Since we may be	 * painting screens other than the current one, we don't want to make	 * the user wait.  We depend heavily on there not being any other lines	 * currently waiting to be displayed and the message truncation code in	 * the msgq_status routine working.	 */	for (tsp = sp->gp->dq.cqh_first;	    tsp != (void *)&sp->gp->dq; tsp = tsp->q.cqe_next)		if (F_ISSET(tsp, SC_STATUS))			vs_resolve(tsp, 0);	/*	 * 3: Related or dirtied screens, or screens with messages.	 *	 * If related screens share a view into a file, they may have been	 * modified as well.  Refresh any screens that aren't exiting that	 * have paint or dirty bits set.  Always update their screens, we	 * are not likely to get another chance.  Finally, if we refresh any	 * screens other than the current one, the cursor will be trashed.	 */	pub_paint = SC_SCR_REFORMAT | SC_SCR_REDRAW;	priv_paint = VIP_CUR_INVALID | VIP_N_REFRESH;	if (O_ISSET(sp, O_NUMBER))		priv_paint |= VIP_N_RENUMBER;	for (tsp = sp->gp->dq.cqh_first;	    tsp != (void *)&sp->gp->dq; tsp = tsp->q.cqe_next)		if (tsp != sp && !F_ISSET(tsp, SC_EXIT | SC_EXIT_FORCE) &&		    (F_ISSET(tsp, pub_paint) ||		    F_ISSET(VIP(tsp), priv_paint))) {			(void)vs_paint(tsp,			    (F_ISSET(VIP(tsp), VIP_CUR_INVALID) ?			    UPDATE_CURSOR : 0) | UPDATE_SCREEN);			F_SET(VIP(sp), VIP_CUR_INVALID);		}	/*	 * 4: Refresh the current screen.	 *	 * Always refresh the current screen, it may be a cursor movement.	 * Also, always do it last -- that way, SC_SCR_REDRAW can be set	 * in the current screen only, and the screen won't flash.	 */	if (vs_paint(sp, UPDATE_CURSOR | (!forcepaint &&	    F_ISSET(sp, SC_SCR_VI) && KEYS_WAITING(sp) ? 0 : UPDATE_SCREEN)))		return (1);	/*	 * A side-effect of refreshing the screen is that it's now ready	 * for everything else, i.e. messages.	 */	F_SET(sp, SC_SCR_VI);	return (0);}