version 1.14, 2009/07/22 15:55:32 |
version 1.15, 2009/07/22 16:45:31 |
|
|
s->rupper = 0; |
s->rupper = 0; |
s->rlower = screen_size_y(s) - 1; |
s->rlower = screen_size_y(s) - 1; |
|
|
tty_write_cmd(ctx->wp, TTY_ALIGNMENTTEST); |
tty_write0(ctx->wp, TTY_ALIGNMENTTEST); |
} |
} |
|
|
/* Insert nx characters. */ |
/* Insert nx characters. */ |
|
|
if (s->cx <= screen_size_x(s) - 1) |
if (s->cx <= screen_size_x(s) - 1) |
grid_view_insert_cells(s->grid, s->cx, s->cy, nx); |
grid_view_insert_cells(s->grid, s->cx, s->cy, nx); |
|
|
tty_write_cmd(ctx->wp, TTY_INSERTCHARACTER, nx); |
tty_writenum(ctx->wp, TTY_INSERTCHARACTER, nx); |
} |
} |
|
|
/* Delete nx characters. */ |
/* Delete nx characters. */ |
|
|
if (s->cx <= screen_size_x(s) - 1) |
if (s->cx <= screen_size_x(s) - 1) |
grid_view_delete_cells(s->grid, s->cx, s->cy, nx); |
grid_view_delete_cells(s->grid, s->cx, s->cy, nx); |
|
|
tty_write_cmd(ctx->wp, TTY_DELETECHARACTER, nx); |
tty_writenum(ctx->wp, TTY_DELETECHARACTER, nx); |
} |
} |
|
|
/* Insert ny lines. */ |
/* Insert ny lines. */ |
|
|
|
|
grid_view_insert_lines(s->grid, s->cy, ny); |
grid_view_insert_lines(s->grid, s->cy, ny); |
|
|
tty_write_cmd(ctx->wp, TTY_INSERTLINE, ny); |
tty_writenum(ctx->wp, TTY_INSERTLINE, ny); |
return; |
return; |
} |
} |
|
|
|
|
else |
else |
grid_view_insert_lines_region(s->grid, s->rlower, s->cy, ny); |
grid_view_insert_lines_region(s->grid, s->rlower, s->cy, ny); |
|
|
tty_write_cmd(ctx->wp, TTY_INSERTLINE, ny); |
tty_writenum(ctx->wp, TTY_INSERTLINE, ny); |
} |
} |
|
|
/* Delete ny lines. */ |
/* Delete ny lines. */ |
|
|
|
|
grid_view_delete_lines(s->grid, s->cy, ny); |
grid_view_delete_lines(s->grid, s->cy, ny); |
|
|
tty_write_cmd(ctx->wp, TTY_DELETELINE, ny); |
tty_writenum(ctx->wp, TTY_DELETELINE, ny); |
return; |
return; |
} |
} |
|
|
|
|
else |
else |
grid_view_delete_lines_region(s->grid, s->rlower, s->cy, ny); |
grid_view_delete_lines_region(s->grid, s->rlower, s->cy, ny); |
|
|
tty_write_cmd(ctx->wp, TTY_DELETELINE, ny); |
tty_writenum(ctx->wp, TTY_DELETELINE, ny); |
} |
} |
|
|
/* Clear line at cursor. */ |
/* Clear line at cursor. */ |
|
|
|
|
grid_view_clear(s->grid, 0, s->cy, screen_size_x(s), 1); |
grid_view_clear(s->grid, 0, s->cy, screen_size_x(s), 1); |
|
|
tty_write_cmd(ctx->wp, TTY_CLEARLINE); |
tty_writenum(ctx->wp, TTY_CLEARLINE, 0); |
} |
} |
|
|
/* Clear to end of line from cursor. */ |
/* Clear to end of line from cursor. */ |
|
|
if (s->cx <= sx - 1) |
if (s->cx <= sx - 1) |
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); |
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); |
|
|
tty_write_cmd(ctx->wp, TTY_CLEARENDOFLINE); |
tty_writenum(ctx->wp, TTY_CLEARENDOFLINE, 0); |
} |
} |
|
|
/* Clear to start of line from cursor. */ |
/* Clear to start of line from cursor. */ |
|
|
else |
else |
grid_view_clear(s->grid, 0, s->cy, s->cx + 1, 1); |
grid_view_clear(s->grid, 0, s->cy, s->cx + 1, 1); |
|
|
tty_write_cmd(ctx->wp, TTY_CLEARSTARTOFLINE); |
tty_writenum(ctx->wp, TTY_CLEARSTARTOFLINE, 0); |
} |
} |
|
|
/* Move cursor to px,py. */ |
/* Move cursor to px,py. */ |
|
|
else if (s->cy > 0) |
else if (s->cy > 0) |
s->cy--; |
s->cy--; |
|
|
tty_write_cmd(ctx->wp, TTY_REVERSEINDEX); |
tty_writenum(ctx->wp, TTY_REVERSEINDEX, 0); |
} |
} |
|
|
/* Set scroll region. */ |
/* Set scroll region. */ |
|
|
else if (s->cy < screen_size_y(s) - 1) |
else if (s->cy < screen_size_y(s) - 1) |
s->cy++; |
s->cy++; |
|
|
tty_write_cmd(ctx->wp, TTY_LINEFEED); |
tty_writenum(ctx->wp, TTY_LINEFEED, 0); |
} |
} |
|
|
/* Carriage return (cursor to start of line). */ |
/* Carriage return (cursor to start of line). */ |
|
|
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); |
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1); |
grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1)); |
grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1)); |
|
|
tty_write_cmd(ctx->wp, TTY_CLEARENDOFSCREEN); |
tty_writenum(ctx->wp, TTY_CLEARENDOFSCREEN, 0); |
} |
} |
|
|
/* Clear to start of screen. */ |
/* Clear to start of screen. */ |
|
|
else |
else |
grid_view_clear(s->grid, 0, s->cy, s->cx + 1, 1); |
grid_view_clear(s->grid, 0, s->cy, s->cx + 1, 1); |
|
|
tty_write_cmd(ctx->wp, TTY_CLEARSTARTOFSCREEN); |
tty_writenum(ctx->wp, TTY_CLEARSTARTOFSCREEN, 0); |
} |
} |
|
|
/* Clear entire screen. */ |
/* Clear entire screen. */ |
|
|
|
|
grid_view_clear(s->grid, 0, 0, screen_size_x(s), screen_size_y(s)); |
grid_view_clear(s->grid, 0, 0, screen_size_x(s), screen_size_y(s)); |
|
|
tty_write_cmd(ctx->wp, TTY_CLEARSCREEN); |
tty_writenum(ctx->wp, TTY_CLEARSCREEN, 0); |
} |
} |
|
|
/* Write cell data. */ |
/* Write cell data. */ |
|
|
{ |
{ |
struct screen *s = ctx->s; |
struct screen *s = ctx->s; |
struct grid *gd = s->grid; |
struct grid *gd = s->grid; |
|
struct tty_ctx ttyctx; |
struct grid_utf8 gu, *tmp_gu; |
struct grid_utf8 gu, *tmp_gu; |
u_int width, xx, i; |
u_int width, xx, i; |
struct grid_cell tmp_gc, *tmp_gc2; |
struct grid_cell tmp_gc, *tmp_gc2; |
|
|
memcpy(tmp_gu->data + i, udata, UTF8_SIZE - i); |
memcpy(tmp_gu->data + i, udata, UTF8_SIZE - i); |
|
|
/* Assume the previous character has just been input. */ |
/* Assume the previous character has just been input. */ |
tty_write_cmd(ctx->wp, TTY_UTF8CHARACTER, udata); |
tty_writeptr(ctx->wp, TTY_UTF8CHARACTER, udata); |
return; |
return; |
} |
} |
|
|
|
|
|
|
/* Draw to the screen if necessary. */ |
/* Draw to the screen if necessary. */ |
if (insert) |
if (insert) |
tty_write_cmd(ctx->wp, TTY_INSERTCHARACTER, width); |
tty_writenum(ctx->wp, TTY_INSERTCHARACTER, width); |
|
ttyctx.wp = ctx->wp; |
|
ttyctx.utf8 = &gu; |
if (screen_check_selection(s, s->cx - width, s->cy)) { |
if (screen_check_selection(s, s->cx - width, s->cy)) { |
s->sel.cell.data = gc->data; |
s->sel.cell.data = gc->data; |
tty_write_cmd(ctx->wp, TTY_CELL, &s->sel.cell, &gu); |
ttyctx.cell = &s->sel.cell; |
} else |
tty_write_cmd(TTY_CELL, &ttyctx); |
tty_write_cmd(ctx->wp, TTY_CELL, gc, &gu); |
} else { |
|
ttyctx.cell = gc; |
|
tty_write_cmd(TTY_CELL, &ttyctx); |
|
} |
} |
} |
|
|
/* |
/* |