From 4cd3114c5013aeccd790582f6cd1dd2760be9dd0 Mon Sep 17 00:00:00 2001 From: james <> Date: Fri, 7 Mar 2008 12:37:04 +0000 Subject: *** empty log message *** --- src/cmd.c | 72 +++++++++++++++++++++++++++++---------------------------------- 1 file changed, 33 insertions(+), 39 deletions(-) (limited to 'src/cmd.c') diff --git a/src/cmd.c b/src/cmd.c index 2707332..3f98331 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* +/* * cmd.c: * * Copyright (c) 2008 James McKenzie , @@ -8,8 +8,11 @@ static char rcsid[] = "$Id$"; -/* +/* * $Log$ + * Revision 1.12 2008/03/07 12:37:04 james + * *** empty log message *** + * * Revision 1.11 2008/03/03 06:04:42 james * *** empty log message *** * @@ -69,13 +72,11 @@ cmd_parse (Cmd * c, Context * ctx, ANSI * a, char *buf) ctx->k->hangup (ctx->k, ctx); else if (!strcmp (buf, "reset")) ctx->k->reset (ctx->k, ctx); - else if (!strcmp (buf, "expand")) - { - int w = a->terminal->size.x; - int h = a->terminal->size.y - 1; - ctx->k->set_size (ctx->k, ctx, w, h); - } - else if (!strncmp (buf, "width", 5)) + else if (!strcmp (buf, "expand")) { + int w = a->terminal->size.x; + int h = a->terminal->size.y - 1; + ctx->k->set_size (ctx->k, ctx, w, h); + } else if (!strncmp (buf, "width", 5)) ctx->k->set_size (ctx->k, ctx, atoi (buf + 5), 0); else if (!strncmp (buf, "height", 6)) ctx->k->set_size (ctx->k, ctx, 0, atoi (buf + 6)); @@ -106,42 +107,35 @@ int cmd_key (Cmd * c, Context * ctx, ANSI * a, int key) { - if (c->error) - { - c->error = 0; + if (c->error) { + c->error = 0; + c->active = 0; + cmd_show_status (c, ctx); + return 0; + } + + if (key == 13) { + if (cmd_parse (c, ctx, a, c->buf + 1)) { + c->error++; + } else { c->active = 0; - cmd_show_status (c, ctx); - return 0; } + cmd_show_status (c, ctx); + return 0; + } - if (key == 13) - { - if (cmd_parse (c, ctx, a, c->buf + 1)) - { - c->error++; - } - else - { - c->active = 0; - } - cmd_show_status (c, ctx); - return 0; - } - - if (((key == 8) || (key == 127)) && (c->ptr > 1)) - { - c->ptr--; - c->buf[c->ptr] = 0; - } + if (((key == 8) || (key == 127)) && (c->ptr > 1)) { + c->ptr--; + c->buf[c->ptr] = 0; + } - if ((key >= 32) && (key < 127)) - { + if ((key >= 32) && (key < 127)) { - c->buf[c->ptr] = key; - c->ptr++; - c->buf[c->ptr] = 0; + c->buf[c->ptr] = key; + c->ptr++; + c->buf[c->ptr] = 0; - } + } cmd_show_status (c, ctx); -- cgit v1.2.3