コード例 #1
0
ファイル: testxmc.c プロジェクト: idunham/dtextra
/*
 * After writing text to the screen, resolve mismatch between the current
 * location and any attributes that would have been set by preceding locations.
 */
void Resolve_XMC(register TScreen *screen)
{
	Boolean changed = False;
	Char start;
	Char my_attrs = (screen->xmc_attributes & XMC_FLAGS);
	int row = screen->cur_row;
	int col = screen->cur_col;

	/* Find the preceding cell.
	 */
	if (getXtermCell(screen, row, col) != XMC_GLITCH) {
		if (col != 0) {
			col--;
		} else if (!screen->xmc_inline && row != 0) {
			row--;
			col = CurMaxCol(screen, row);
		}
	}
	start = (SCRN_BUF_ATTRS(screen, row)[col] & my_attrs);

	/* Now propagate the starting state until we reach a cell which holds
	 * a glitch.
	 */
	for (;;) {
		if (col < CurMaxCol(screen, row)) {
			col++;
		} else if (!screen->xmc_inline && row < screen->max_row) {
			row++;
			col = 0;
		} else
			break;
		if (getXtermCell(screen, row, col) == XMC_GLITCH)
			break;
		if ((SCRN_BUF_ATTRS(screen, row)[col] & my_attrs) != start) {
			SCRN_BUF_ATTRS(screen, row)[col] = start |
				(SCRN_BUF_ATTRS(screen, row)[col] & ~my_attrs);
			changed = True;
		}
	}

	TRACE(("XMC %s (%s:%d/%d) from %d,%d to %d,%d\n",
		changed ? "Ripple" : "Nochange",
		term->flags & my_attrs ? "on" : "off",
		my_attrs, start,
		screen->cur_row, screen->cur_col, row, col));

	if (changed) {
		ScrnRefresh (screen, screen->cur_row, 0, row + 1 - screen->cur_row, screen->max_col + 1, True);
	}
}
コード例 #2
0
ファイル: screen.c プロジェクト: rickgaiser/xfree86-ps2
/*
 * Writes str into buf at screen's current row and column.  Characters are set
 * to match flags.
 */
void
ScreenWrite (
	TScreen *screen,
	Char *str,
	register unsigned flags,
	register unsigned cur_fg_bg,
	register int length)		/* length of string */
{
#if OPT_ISO_COLORS
	register Char *fb = 0;
#endif
#if OPT_DEC_CHRSET
	register Char *cb = 0;
#endif
	register Char *attrs;
	register int avail  = screen->max_col - screen->cur_col + 1;
	register Char *col;
	register int wrappedbit;

	if (length > avail)
	    length = avail;
	if (length <= 0)
		return;

	col   = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col;
	attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col;

	if_OPT_ISO_COLORS(screen,{
		fb = SCRN_BUF_COLOR(screen, screen->cur_row) + screen->cur_col;
	})
コード例 #3
0
ファイル: screen.c プロジェクト: aosm/X11
/*
 * Writes str into buf at screen's current row and column.  Characters are set
 * to match flags.
 */
void
ScreenWrite(TScreen * screen,
	    PAIRED_CHARS(Char * str, Char * str2),
	    unsigned flags,
	    unsigned cur_fg_bg,
	    int len)		/* length of string */
{
#if OPT_ISO_COLORS
#if OPT_EXT_COLORS
    Char *fbf = 0;
    Char *fbb = 0;
#else
    Char *fb = 0;
#endif
#endif
#if OPT_DEC_CHRSET
    Char *cb = 0;
#endif
    int length = len;		/* workaround for compiler bug? */
    Char *attrs;
    int avail = screen->max_col - screen->cur_col + 1;
    Char *col;
    int wrappedbit;
#if OPT_WIDE_CHARS
    Char starcol, starcol2;
    Char *comb1l = 0, *comb1h = 0, *comb2l = 0, *comb2h = 0;
#endif

#if OPT_WIDE_CHARS
    int real_width = visual_width(PAIRED_CHARS(str, str2), length);
#else
    int real_width = length;
#endif

    if (length > avail)
	length = avail;
    if (length <= 0)
	return;

    col = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col;
    attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col;

    if_OPT_WIDE_CHARS(screen, {
	comb1l = SCRN_BUF_COM1L(screen, screen->cur_row) + screen->cur_col;
	comb1h = SCRN_BUF_COM1H(screen, screen->cur_row) + screen->cur_col;
	comb2l = SCRN_BUF_COM2L(screen, screen->cur_row) + screen->cur_col;
	comb2h = SCRN_BUF_COM2H(screen, screen->cur_row) + screen->cur_col;
    });
コード例 #4
0
ファイル: screen.c プロジェクト: ThomasDickey/old-xterm
/*
 * Writes str into buf at screen's current row and column.  Characters are set
 * to match flags.
 */
void
ScreenWrite(TScreen * screen,
	    PAIRED_CHARS(Char * str, Char * str2),
	    unsigned flags,
	    unsigned cur_fg_bg,
	    unsigned length)
{
#if OPT_ISO_COLORS
#if OPT_EXT_COLORS
    Char *fbf = 0;
    Char *fbb = 0;
#else
    Char *fb = 0;
#endif
#endif
#if OPT_DEC_CHRSET
    Char *cb = 0;
#endif
    Char *attrs;
    int avail = MaxCols(screen) - screen->cur_col;
    Char *chars;
    int wrappedbit;
#if OPT_WIDE_CHARS
    Char starcol1, starcol2;
    Char *comb1l = 0, *comb1h = 0, *comb2l = 0, *comb2h = 0;
#endif
    unsigned real_width = visual_width(PAIRED_CHARS(str, str2), length);

    if (avail <= 0)
	return;
    if (length > (unsigned) avail)
	length = avail;
    if (length == 0 || real_width == 0)
	return;

    chars = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col;
    attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col;

    if_OPT_WIDE_CHARS(screen, {
	comb1l = SCRN_BUF_COM1L(screen, screen->cur_row) + screen->cur_col;
	comb1h = SCRN_BUF_COM1H(screen, screen->cur_row) + screen->cur_col;
	comb2l = SCRN_BUF_COM2L(screen, screen->cur_row) + screen->cur_col;
	comb2h = SCRN_BUF_COM2H(screen, screen->cur_row) + screen->cur_col;
    });
コード例 #5
0
ファイル: util.c プロジェクト: rickgaiser/xfree86-ps2
/*
 * Clear the given row, for the given range of columns, returning 1 if no
 * protected characters were found, 0 otherwise.
 */
static int
ClearInLine(register TScreen *screen, int row, int col, int len)
{
	int rc = 1;
	int flags = TERM_COLOR_FLAGS;

	/*
	 * If we're clearing to the end of the line, we won't count this as
	 * "drawn" characters.  We'll only do cut/paste on "drawn" characters,
	 * so this has the effect of suppressing trailing blanks from a
	 * selection.
	 */
	if (col + len + 1 < screen->max_col)
		flags |= CHARDRAWN;

	/* If we've marked protected text on the screen, we'll have to
	 * check each time we do an erase.
	 */
	if (screen->protected_mode != OFF_PROTECT) {
		register int n;
		Char *attrs = SCRN_BUF_ATTRS(screen, row) + col;
		int saved_mode = screen->protected_mode;
		Bool done;

		/* disable this branch during recursion */
		screen->protected_mode = OFF_PROTECT;

		do {
			done = True;
			for (n = 0; n < len; n++) {
				if (attrs[n] & PROTECTED) {
					rc = 0; /* found a protected segment */
					if (n != 0)
						ClearInLine(screen, row, col, n);
					while ((n < len)
					   &&  (attrs[n] & PROTECTED))
						n++;
					done = False;
					break;
				}
			}
			/* setup for another segment, past the protected text */
			if (!done) {
				attrs += n;
				col += n;
				len -= n;
			}
		} while (!done);

		screen->protected_mode = saved_mode;
		if (len <= 0)
			return 0;
	}
	/* fall through to the final non-protected segment */

	if(screen->cursor_state)
		HideCursor();
	screen->do_wrap = 0;

	if (row - screen->topline <= screen->max_row) {
		if(!AddToRefresh(screen)) {
			if(screen->scroll_amt)
				FlushScroll(screen);
			ClearCurBackground (
				screen,
				CursorY (screen, row),
				CurCursorX (screen, row, col),
				FontHeight(screen),
				len * CurFontWidth(screen,row));
		}
	}

	memset(SCRN_BUF_CHARS(screen, row) + col, ' ',   len);
	memset(SCRN_BUF_ATTRS(screen, row) + col, flags, len);

	if_OPT_ISO_COLORS(screen,{
		memset(SCRN_BUF_COLOR(screen, row) + col, xtermColorPair(), len);
	})