about summary refs log tree commit diff stats
path: root/src/lcurseslib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lcurseslib.c')
-rw-r--r--src/lcurseslib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lcurseslib.c b/src/lcurseslib.c
index d9bcd37..515c30c 100644
--- a/src/lcurseslib.c
+++ b/src/lcurseslib.c
@@ -1,6 +1,7 @@
 #include <ncurses.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "lua.h"
 #include "llimits.h"
@@ -88,15 +89,20 @@ static int Pcolor_pair (lua_State *L)
 }
 
 
-extern const char *Script_name;
+extern char **Argv;
+extern char *Script_name;
+extern void edit(char* filename);
 static int Pgetch (lua_State *L) {
   int c = wgetch(stdscr);
   if (c == ERR)
     return 0;
   if (c == 24)  /* ctrl-x */
     exit(0);
-  if (c == 5)  /* ctrl-e */
+  if (c == 5) {  /* ctrl-e */
+    /* death and rebirth */
     edit(Script_name);
+    execv(Argv[0], Argv);
+  }
   /* handle other standard menu hotkeys here */
   lua_pushinteger(L, c);
   return 1;