chiark / gitweb /
*** empty log message ***
authorjames <james>
Fri, 29 Feb 2008 22:50:29 +0000 (22:50 +0000)
committerjames <james>
Fri, 29 Feb 2008 22:50:29 +0000 (22:50 +0000)
src/ansi.c
src/cmd.c
src/prototypes.h

index 970d353a2670d874d0f59ce80f04d897bd52da5a..ae89f61ef32d2960bff5d32f6597289cc60822f9 100644 (file)
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.37  2008/02/29 22:50:29  james
+ * *** empty log message ***
+ *
  * Revision 1.36  2008/02/28 22:00:42  james
  * *** empty log message ***
  *
@@ -740,11 +743,16 @@ int ansi_key(ANSI *a,Context *c,int key)
 
   cmd_show_status (c->d, c);
 
-  if (c->d->active)
-    return cmd_key (c->d, c,a, key);
 
-  if (key == CMD_KEY)
+  if (c->d->active) {
+       if (key == CMD_KEY)
+    return cmd_deactivate (c->d, c);
+       }else {
+    return cmd_key (c->d, c,a, key);
+       }
+  } else if (key == CMD_KEY)
     return cmd_activate (c->d, c);
+  }
 
 
   return c->k->key (c->k, c, key);
index 34dc2f4e54bd42db849423094d2deb3a86f239c3..c2d5e57a41dad57f6dcc5afde13c3e673896ce42 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.8  2008/02/29 22:50:29  james
+ * *** empty log message ***
+ *
  * Revision 1.7  2008/02/28 22:00:42  james
  * *** empty log message ***
  *
@@ -136,6 +139,14 @@ cmd_key (Cmd * c, Context * ctx,ANSI *a, int key)
 }
 
 
+int
+cmd_deactivate (Cmd * c, Context * ctx)
+{
+  c->active = 0;
+  cmd_show_status (c, ctx);
+  return 0;
+}
+
 int
 cmd_activate (Cmd * c, Context * ctx)
 {
index c3787644d521508b23a5fefb610fb030de9772a9..074f1a913458cf8177d3f478408e045e9dba7f08 100644 (file)
@@ -146,6 +146,8 @@ extern TTY *serial_open(char *path, int lock_mode);
 /* cmd.c */
 extern int cmd_parse(Cmd *c, Context *ctx, ANSI *a, char *buf);
 extern void cmd_show_status(Cmd *c, Context *ctx);
+extern int cmd_key(Cmd *c, Context *ctx, ANSI *a, int key);
+extern int cmd_deactivate(Cmd *c, Context *ctx);
 extern int cmd_activate(Cmd *c, Context *ctx);
 extern void cmd_new_status(Cmd *c, Context *ctx, char *msg);
 extern Cmd *cmd_new(void);