Beispiel #1
0
// TODO
// move this function to vtuikit.c
void
cursor_clear(int row, int column)
{
    move(row, column);
    if (HasUserFlag(UF_CURSOR_ASCII))
        outs(STR_UNCUR);
    else
        outs(STR_UNCUR2);

    if (HasUserFlag(UF_MENU_LIGHTBAR)) {
        grayout(row, row + 1, GRAYOUT_COLORNORM);
    }
}
Beispiel #2
0
// TODO
// move this function to vtuikit.c
void
cursor_show(int row, int column)
{
    if (HasUserFlag(UF_MENU_LIGHTBAR)) {
        grayout(row, row + 1, GRAYOUT_COLORBOLD);
    }
    move(row, column);
    if (HasUserFlag(UF_CURSOR_ASCII)) {
        outs(STR_CURSOR);
        move(row, column);
    } else {
        outs(STR_CURSOR2);
        move(row, column + 1);
    }
}
Beispiel #3
0
void
redrawwin(void)
{
    register screenline_t *bp;
    register int    i, j;
    int len;

    o_clear();
    for (tc_col = tc_line = i = 0, j = roll; i < t_lines; i++, j++) {
	if (j >= t_lines)
	    j = 0;
	bp = &big_picture[j];
	if ((len = bp->len)) {
	    rel_move(tc_col, tc_line, 0, i);

#ifdef DBCSAWARE
	    if (!(bp->mode & STANDOUT) &&
		    (HasUserFlag(UF_DBCS_NOINTRESC)) &&
		    DBCS_RemoveIntrEscape(bp->data, &len))
	    {
		// if anything changed, dirty whole line.
		bp->len = len;
	    }
#endif // DBCSAWARE

	    if (bp->mode & STANDOUT) {
		standoutput((char *)bp->data, 0, len, bp->sso, bp->eso);
	    }
	    else
		output((char *)bp->data, len);
	    tc_col += len;
	    if (tc_col >= t_columns) {
		if (automargins)
		    tc_col = t_columns - 1;
		else {
		    tc_col -= t_columns;
		    tc_line++;
		    if (tc_line >= t_lines)
			tc_line = b_lines;
		}
	    }
	    bp->mode &= ~(MODIFIED);
	    bp->oldlen = len;
	}
    }
    rel_move(tc_col, tc_line, cur_col, cur_ln);
    docls = scrollcnt = 0;
    oflush();
}
Beispiel #4
0
void
doupdate(void)
{
    /* TODO remove unnecessary refresh() call, to save CPU time */
    register screenline_t *bp = big_picture;
    register int    i, j;
    int len;
    if ((docls) || (abs(scrollcnt) >= (t_lines - 3))) {
	redrawwin();
	return;
    }
    if (scrollcnt < 0) {
	if (!scrollrevlen) {
	    redrawwin();
	    return;
	}
	rel_move(tc_col, tc_line, 0, 0);
	do {
	    o_scrollrev();
	} while (++scrollcnt);
    } else if (scrollcnt > 0) {
	rel_move(tc_col, tc_line, 0, b_lines);
	do {
	    ochar('\n');
	} while (--scrollcnt);
    }
    for (i = 0, j = roll; i < t_lines; i++, j++) {
	if (j >= t_lines)
	    j = 0;
	bp = &big_picture[j];
	len = bp->len;

	if (bp->mode & MODIFIED && bp->smod < len) 
	{
	    bp->mode &= ~(MODIFIED);

#ifdef DBCSAWARE
	    if (!(bp->mode & STANDOUT) &&
		(HasUserFlag(UF_DBCS_NOINTRESC)) &&
		DBCS_RemoveIntrEscape(bp->data, &len))
	    {
		// if anything changed, dirty whole line.
		bp->len = len;
		bp->smod = 0; bp->emod = len;
	    }
#endif // DBCSAWARE

// disable this if you encounter some bugs.
// bug history:
// (1) input number (goto) in bbs list (search_num) [solved: search_num merged to vget]
// (2) some empty lines becomes weird (eg, b_config) [not seen anymore?]
#if 1
	    if (bp->smod > 0)
	    {
		// more effort to determine ANSI smod
		int iesc;
		for (iesc = bp->smod-1; iesc >= 0; iesc--)
		{
		    if (bp->data[iesc] == ESC_CHR)
		    {
			bp->smod = 0;// iesc;
			bp->emod =len -1;
			break;
		    }
		}
	    }
#endif
	    
	    if (bp->emod >= len)
		bp->emod = len - 1;
	    rel_move(tc_col, tc_line, bp->smod, i);

	    if (bp->mode & STANDOUT)
		standoutput((char *)bp->data, bp->smod, bp->emod + 1,
			    bp->sso, bp->eso);
	    else
		output((char *)&bp->data[bp->smod], bp->emod - bp->smod + 1);
	    tc_col = bp->emod + 1;
	    if (tc_col >= t_columns) {
		if (automargins)
		    tc_col = t_columns - 1;
		else {
		    tc_col -= t_columns;
		    tc_line++;
		    if (tc_line >= t_lines)
			tc_line = b_lines;
		}
	    }
	}
	if (bp->oldlen > len) {
	    /* XXX len/oldlen also count the length of escape sequence,
	     * before we fix it, we must print ANSI_CLRTOEND everywhere */
	    rel_move(tc_col, tc_line, len, i);
	    o_cleol();
	}
	bp->oldlen = len;
    }

    rel_move(tc_col, tc_line, cur_col, cur_ln);

    oflush();
}