summaryrefslogtreecommitdiffstats
path: root/screen.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-11-25 10:56:22 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-11-25 10:56:22 +0000
commit87b418b13ee7aa0912a6d83591b5bc9d24015246 (patch)
tree013c7063c5f691551cd8e1917ecd182114fdc4cf /screen.c
parent15511cb41a3fc12ba627aa792ba871d64a7a860d (diff)
Redo output logging in local.c. Optimise line drawing.
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/screen.c b/screen.c
index 1cd2072f..a48a84a2 100644
--- a/screen.c
+++ b/screen.c
@@ -1,4 +1,4 @@
-/* $Id: screen.c,v 1.44 2007-11-24 19:29:56 nicm Exp $ */
+/* $Id: screen.c,v 1.45 2007-11-25 10:56:22 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -382,7 +382,15 @@ screen_draw_move(struct screen_draw_ctx *ctx, u_int px, u_int py)
if (px == ctx->cx && py == ctx->cy)
return;
- input_store_two(ctx->b, CODE_CURSORMOVE, py + 1, px + 1);
+ if (px == 0 && py == ctx->cy)
+ input_store8(ctx->b, '\r');
+ else if (px == ctx->cx && py == ctx->cy + 1)
+ input_store8(ctx->b, '\n');
+ else if (px == 0 && py == ctx->cy + 1) {
+ input_store8(ctx->b, '\r');
+ input_store8(ctx->b, '\n');
+ } else
+ input_store_two(ctx->b, CODE_CURSORMOVE, py + 1, px + 1);
ctx->cx = px;
ctx->cy = py;
@@ -444,7 +452,18 @@ screen_draw_column(struct screen_draw_ctx *ctx, u_int px)
void
screen_draw_line(struct screen_draw_ctx *ctx, u_int py)
{
- screen_draw_cells(ctx, 0, py, screen_size_x(ctx->s));
+ u_int cx, cy;
+
+ cy = screen_y(ctx->s, py) - ctx->oy;
+ cx = ctx->s->grid_size[cy];
+
+ if (screen_size_x(ctx->s) < 3 || cx >= screen_size_x(ctx->s) - 3)
+ screen_draw_cells(ctx, 0, py, screen_size_x(ctx->s));
+ else {
+ screen_draw_cells(ctx, 0, py, cx);
+ screen_draw_move(ctx, cx, cy);
+ input_store_zero(ctx->b, CODE_CLEARENDOFLINE);
+ }
}
/* Draw set of lines. */