コード例 #1
0
ファイル: video.c プロジェクト: pcostesi/tp2-so-2015b
void vid_raw_putc(enum vid_term term, const char c, const enum VID_COLOR fmt)
{
	int row, col;
	struct vid_mem * active = get_active_term(term);

	if (active->cursor >= VID_POS(ROWS - 1, COLS)) {
		vid_scroll(term);
		vid_cursor(term, ROWS - 1, 0);
	}

	row = active->cursor / COLS;
	col = active->cursor % COLS;

	switch (c) {
		case '\n':
		while (active->cursor < VID_POS(row + 1, 0)) {
			_print(active, (char) 0, fmt);
		}
		vid_cursor(term, row + 1, 0);
		break;
	
		case '\r':
		vid_cursor(term, row, 0);
		break;

		case '\b':
            row = (col - 1 < 0) ? MAX(row - 1, 0) : row;
            col = (col - 1 < 0) ? COLS + col - 1 : col - 1;
		vid_cursor(term, row, col);
		break;

		case '\t':
		do {
			_print(active, (char) 0, fmt);
			col += 1;
		} while (col < COLS && col < TAB_SIZE);
		break;
	
		default:
		_print(active, c, fmt);
	}
}
コード例 #2
0
ファイル: video.c プロジェクト: FMNSSun/NoOS
NVALUE vid_inc_row() {
  vid_row++;
  if(vid_row > (vid_t_height-1)) { vid_row = (vid_t_height-1); vid_column = 0; vid_scroll(); }
}