diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-04 18:50:35 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-04 18:50:35 +0000 |
commit | 39be570b2079c38609ae6cc6c6e2bf937649d481 (patch) | |
tree | 99daaadf37fecb72bde436e591dd0eaa91cdeed9 /screen-write.c | |
parent | 04c60283c42618f8f97e49452e1022908b4ec5e6 (diff) |
vi keys from Will Maier.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/screen-write.c b/screen-write.c index f0693ec3..01b749ab 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $Id: screen-write.c,v 1.5 2007-12-06 19:57:01 nicm Exp $ */ +/* $Id: screen-write.c,v 1.6 2008-06-04 18:50:34 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -98,10 +98,12 @@ screen_write_set_title(struct screen_write_ctx *ctx, char *title) } /* Put a character. */ -void +int screen_write_put_character(struct screen_write_ctx *ctx, u_char ch) { struct screen *s = ctx->s; + u_char data, attr, colr; + int n; if (s->cx == screen_size_x(s)) { s->cx = 0; @@ -110,14 +112,20 @@ screen_write_put_character(struct screen_write_ctx *ctx, u_char ch) screen_write_cursor_down_scroll(ctx); } else if (!screen_in_x(s, s->cx) || !screen_in_y(s, s->cy)) { SCREEN_DEBUG(s); - return; + return (0); } - screen_display_set_cell(s, s->cx, s->cy, ch, s->attr, s->colr); + screen_display_get_cell(s, s->cx, s->cy, &data, &attr, &colr); + if (ch != data || s->attr != attr || colr != s->colr) { + screen_display_set_cell(s, s->cx, s->cy, ch, s->attr, s->colr); + n = 1; + } else + n = 0; s->cx++; if (ctx->write != NULL) ctx->write(ctx->data, TTY_CHARACTER, ch); + return (n); } /* Put a string right-justified. */ |