[net.sources] More uEMACS

bright@dataio.UUCP (03/04/87)

This patch for microEMACS is for all you people who are sick of screen
updates taking forever if you have more than one window on a buffer. The
problem is that the old lchange() routine would force a hard update on
all windows on the buffer. The new routine below only forces a hard update
on those windows on the buffer that are not the currently active one. This
usually about doubles the update speed.

/*
 * This routine gets called when a character is changed in place in the current
 * buffer. It updates all of the required flags in the buffer and window
 * system. The flag used is passed as an argument; if the buffer is being
 * displayed in more than 1 window we change EDIT to HARD. Set MODE if the
 * mode line needs to be updated (the "*" has to be set).
 * Modified by Walter Bright to reduce update times.
 */
lchange(flag)
register int    flag;
{
        register WINDOW *wp;

        if ((curbp->b_flag&BFCHG) == 0)		/* First change, so     */
	{	flag |= WFMODE;			/* update mode lines.   */
                curbp->b_flag |= BFCHG;
        }
        for (wp = wheadp; wp; wp = wp->w_wndp)
	{
                if (wp->w_bufp == curbp)
		{
		    wp->w_flag |= flag;
		    if (wp != curwp)
			wp->w_flag |= WFHARD;
		}
        }
}