Beispiel #1
0
/*
 * 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(XtermWidget xw)
{
    TScreen *screen = TScreenOf(xw);
    LineData *ld;
    Bool changed = False;
    Char start;
    Char my_attrs = CharOf(screen->xmc_attributes & XMC_FLAGS);
    int row = screen->cur_row;
    int col = screen->cur_col;

    /* Find the preceding cell.
     */
    ld = getLineData(screen, row);
    if (ld->charData[col] != XMC_GLITCH) {
	if (col != 0) {
	    col--;
	} else if (!screen->xmc_inline && row != 0) {
	    ld = getLineData(screen, --row);
	    col = LineMaxCol(screen, ld);
	}
    }
    start = (ld->attribs[col] & my_attrs);

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

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

    if (changed) {
	ScrnUpdate(xw, screen->cur_row, 0, row + 1 - screen->cur_row,
		   MaxCols(screen), True);
    }
}
Beispiel #2
0
/*
 * Force a glitch on cursor movement when we're in standout mode and not at the
 * end of a line.
 */
void
Jump_XMC(XtermWidget xw)
{
    TScreen *screen = TScreenOf(xw);
    if (!screen->move_sgr_ok
	&& screen->cur_col <= LineMaxCol(screen,
					 getLineData(screen, screen->cur_row))) {
	Mark_XMC(xw, -1);
    }
}
Beispiel #3
0
/*
 * Tab to the next stop, returning true if the cursor moved
 */
Bool
TabToNextStop(XtermWidget xw)
{
    TScreen *screen = TScreenOf(xw);
    int saved_column = screen->cur_col;
    int next = TabNext(xw, xw->tabs, screen->cur_col);
    int max = LineMaxCol(screen, getLineData(screen, screen->cur_row));

    if (next > max)
	next = max;
    set_cur_col(screen, next);

    return (screen->cur_col > saved_column);
}
Beispiel #4
0
/*
 * moves the cursor forward n, no wraparound
 */
void
CursorForward(XtermWidget xw, int n)
{
    TScreen *screen = TScreenOf(xw);
#if OPT_DEC_CHRSET
    LineData *ld = getLineData(screen, screen->cur_row);
#endif
    int next = screen->cur_col + n;
    int max;

    if (IsLeftRightMode(xw)) {
	max = screen->rgt_marg;
	if (screen->cur_col > max)
	    max = screen->max_col;
    } else {
	max = LineMaxCol(screen, ld);
    }

    if (next > max)
	next = max;

    set_cur_col(screen, next);
    ResetWrap(screen);
}