diff options
author | james <> | 2012-06-22 10:22:25 +0000 |
---|---|---|
committer | james <> | 2012-06-22 10:22:25 +0000 |
commit | c945112e89222e697c3733c69eab685f606a5be5 (patch) | |
tree | 20d0d125ed4d76259f87740d5cd9344bcade24d5 /src/cmd.c | |
parent | 9a219228a74b32f3b3202609a155d8f22ba47da8 (diff) | |
download | sympathy-c945112e89222e697c3733c69eab685f606a5be5.tar.gz sympathy-c945112e89222e697c3733c69eab685f606a5be5.tar.bz2 sympathy-c945112e89222e697c3733c69eab685f606a5be5.zip |
*** empty log message ***
Diffstat (limited to 'src/cmd.c')
-rw-r--r-- | src/cmd.c | 70 |
1 files changed, 42 insertions, 28 deletions
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.14 2012/06/22 10:22:24 james + * *** empty log message *** + * * Revision 1.13 2008/03/07 13:16:02 james * *** empty log message *** * @@ -75,11 +78,13 @@ 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)); @@ -110,35 +115,42 @@ int cmd_key (Cmd * c, Context * ctx, ANSI * a, int key) { - 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 { + if (c->error) + { + c->error = 0; c->active = 0; + cmd_show_status (c, ctx); + return 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 == 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 >= 32) && (key < 127)) { + if (((key == 8) || (key == 127)) && (c->ptr > 1)) + { + c->ptr--; + c->buf[c->ptr] = 0; + } + + 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); @@ -187,4 +199,6 @@ cmd_new (void) ret->active = 0; ret->error = 0; ret->csl[0] = 0; + + return ret; } |