int i, j, left, top, right, bottom;
int i, j; if (left < 0) left = 0; if (top < 0) top = 0; if (right >= cols) right = cols-1; if (bottom >= rows) bottom = rows-1;
void term_paint(Context ctx, int l, int t, int r, int b){    int i, j, left, top, right, bottom;    left = l / font_width;    right = (r - 1) / font_width;    top = t / font_height;    bottom = (b - 1) / font_height;    for (i = top; i <= bottom && i < rows; i++) {	if ((disptext[i * (cols + 1) + cols] & LATTR_MODE) == LATTR_NORM)	    for (j = left; j <= right && j < cols; j++)		disptext[i * (cols + 1) + j] = ATTR_INVALID;	else	    for (j = left / 2; j <= right / 2 + 1 && j < cols; j++)		disptext[i * (cols + 1) + j] = ATTR_INVALID;    }    /* This should happen soon enough, also for some reason it sometimes      * fails to actually do anything when re-sizing ... painting the wrong     * window perhaps ?     do_paint (ctx, FALSE);     */}