Пример #1
0
/*
 * moves the cursor forward n, no wraparound
 */
void
CursorForward(register TScreen *screen, int n)
{
	screen->cur_col += n;
	if (screen->cur_col > CurMaxCol(screen, screen->cur_row))
		screen->cur_col = CurMaxCol(screen, screen->cur_row);
	screen->do_wrap = 0;
	_CheckSelection(screen);
}
Пример #2
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(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);
	}
}
Пример #3
0
/*
 * Force a glitch on cursor movement when we're in standout mode and not at the
 * end of a line.
 */
void Jump_XMC(register TScreen *screen)
{
	if (!screen->move_sgr_ok
	 && screen->cur_col <= CurMaxCol(screen, screen->cur_row)) {
		Mark_XMC(screen, -1);
	}
}
Пример #4
0
/*
 * moves the cursor forward n, no wraparound
 */
void
CursorForward(TScreen * screen, int n)
{
    int next = screen->cur_col + n;
    int max = CurMaxCol(screen, screen->cur_row);

    if (next > max)
	next = max;

    set_cur_col(screen, next);
    screen->do_wrap = 0;
}
Пример #5
0
/*
 * Tab to the next stop, returning true if the cursor moved
 */
Bool
TabToNextStop(TScreen * screen)
{
    int saved_column = screen->cur_col;
    int next = TabNext(screen, term->tabs, screen->cur_col);
    int max = CurMaxCol(screen, screen->cur_row);

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

    return (screen->cur_col > saved_column);
}