cursor = ATTR_ACTCURS;
cursor = TATTR_ACTCURS;
static void do_paint(Context ctx, int may_optimise){    int i, j, start, our_curs_y;    unsigned long attr, rv, cursor;    pos scrpos;    char ch[1024];    long ticks;    /*     * Check the visual bell state.     */    if (in_vbell) {	ticks = GetTickCount();	if (ticks - vbell_timeout >= 0)	    in_vbell = FALSE;    }    /* Depends on:     * screen array, disptop, scrtop,     * selection, rv,      * cfg.blinkpc, blink_is_real, tblinker,      * curs.y, curs.x, blinker, cfg.blink_cur, cursor_on, has_focus     */    if (cursor_on) {	if (has_focus) {	    if (blinker || !cfg.blink_cur)		cursor = ATTR_ACTCURS;	    else		cursor = 0;	} else	    cursor = ATTR_PASCURS;	if (wrapnext)	    cursor |= ATTR_RIGHTCURS;    } else	cursor = 0;    rv = (!rvideo ^ !in_vbell ? ATTR_REVERSE : 0);    our_curs_y = curs.y - disptop;    for (i = 0; i < rows; i++) {	unsigned long *ldata;	int lattr;	scrpos.y = i + disptop;	ldata = lineptr(scrpos.y);	lattr = (ldata[cols] & LATTR_MODE);	for (j = 0; j <= cols; j++) {	    unsigned long d = ldata[j];	    int idx = i * (cols + 1) + j;	    scrpos.x = j;	    wanttext[idx] = lattr | (((d & ~ATTR_WRAPPED) ^ rv				      ^ (posle(selstart, scrpos) &&					 poslt(scrpos, selend) ?					 ATTR_REVERSE : 0)) |				     (i == our_curs_y				      && j == curs.x ? cursor : 0));	    if (blink_is_real) {		if (has_focus && tblinker && (wanttext[idx] & ATTR_BLINK)) {		    wanttext[idx] &= ATTR_MASK;		    wanttext[idx] += ' ';		}		wanttext[idx] &= ~ATTR_BLINK;	    }	}    }    /*     * We would perform scrolling optimisations in here, if they     * didn't have a nasty tendency to cause the whole sodding     * program to hang for a second at speed-critical moments.     * We'll leave it well alone...     */    for (i = 0; i < rows; i++) {	int idx = i * (cols + 1);	int lattr = (wanttext[idx + cols] & LATTR_MODE);	start = -1;	for (j = 0; j <= cols; j++, idx++) {	    unsigned long t = wanttext[idx];	    int needs_update = (j < cols && t != disptext[idx]);	    int keep_going = (start != -1 && needs_update &&			      (t & ATTR_MASK) == attr &&			      j - start < sizeof(ch));	    if (start != -1 && !keep_going) {		do_text(ctx, start, i, ch, j - start, attr, lattr);		start = -1;	    }	    if (needs_update) {		if (start == -1) {		    start = j;		    attr = t & ATTR_MASK;		}		ch[j - start] = (char) (t & CHAR_MASK);	    }	    disptext[idx] = t;	}    }}