version 1.63, 2013/03/22 10:33:50 |
version 1.64, 2013/03/22 10:36:54 |
|
|
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 tty_ctx ttyctx; |
u_int width, xx; |
u_int width, xx, last; |
struct grid_cell tmp_gc, *tmp_gcp; |
struct grid_cell tmp_gc, *tmp_gcp; |
struct utf8_data ud; |
struct utf8_data ud; |
int insert = 0; |
int insert; |
|
|
/* Ignore padding. */ |
/* Ignore padding. */ |
if (gc->flags & GRID_FLAG_PADDING) |
if (gc->flags & GRID_FLAG_PADDING) |
|
|
xx = screen_size_x(s) - s->cx - width; |
xx = screen_size_x(s) - s->cx - width; |
grid_move_cells(s->grid, s->cx + width, s->cx, s->cy, xx); |
grid_move_cells(s->grid, s->cx + width, s->cx, s->cy, xx); |
insert = 1; |
insert = 1; |
} |
} else |
|
insert = 0; |
|
|
/* Check this will fit on the current line and wrap if not. */ |
/* Check this will fit on the current line and wrap if not. */ |
if ((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - width) { |
if ((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - width) { |
|
|
s->cx = 0; /* carriage return */ |
s->cx = 0; /* carriage return */ |
} |
} |
|
|
/* Sanity checks. */ |
/* Sanity check cursor position. */ |
if (((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - width) |
if (s->cx > screen_size_x(s) - width || s->cy > screen_size_y(s) - 1) |
|| s->cy > screen_size_y(s) - 1) |
|
return; |
return; |
|
|
/* Handle overwriting of UTF-8 characters. */ |
/* Handle overwriting of UTF-8 characters. */ |
|
|
/* Set the cell. */ |
/* Set the cell. */ |
grid_view_set_cell(gd, s->cx, s->cy, gc); |
grid_view_set_cell(gd, s->cx, s->cy, gc); |
|
|
/* Move the cursor. */ |
/* |
s->cx += width; |
* Move the cursor. If not wrapping, stick at the last character and |
|
* replace it. |
|
*/ |
|
last = !!(s->mode & MODE_WRAP); |
|
if (s->cx <= screen_size_x(s) - last - width) |
|
s->cx += width; |
|
else |
|
s->cx = screen_size_x(s) - last; |
|
|
/* Draw to the screen if necessary. */ |
/* Draw to the screen if necessary. */ |
if (insert) { |
if (insert) { |