diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-11 16:42:02 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-11 16:42:02 -0800 |
commit | d303c6efb0ee91d6adfae977908ff63c18f51e96 (patch) | |
tree | f7b1fd014124811f1faaec0833e01cbaa5411cec | |
parent | 0d6378aa51f8dfb1f0b1c175a8f56223232d9f52 (diff) | |
download | teliva-d303c6efb0ee91d6adfae977908ff63c18f51e96.tar.gz |
pass lua_State into editor
-rw-r--r-- | src/kilo.c | 6 | ||||
-rw-r--r-- | src/lua.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/kilo.c b/src/kilo.c index e8cb618..35aa577 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -1164,7 +1164,7 @@ void editorMoveCursor(int key) { * is typing stuff on the terminal. */ #define KILO_QUIT_TIMES 3 int Quit = 0; -void editorProcessKeypress(int fd) { +void editorProcessKeypress(lua_State* L, int fd) { int c = editorReadKey(fd); switch(c) { case ENTER: @@ -1255,14 +1255,14 @@ void initEditor(void) { signal(SIGWINCH, handleSigWinCh); } -void edit(char* filename, char* message) { +void edit(lua_State* L, char* filename, char* message) { initEditor(); editorOpen(filename); enableRawMode(STDIN_FILENO); editorSetStatusMessage(message); while(!Quit) { editorRefreshScreen(); - editorProcessKeypress(STDIN_FILENO); + editorProcessKeypress(L, STDIN_FILENO); } disableRawMode(STDIN_FILENO); } diff --git a/src/lua.c b/src/lua.c index 2b94349..1040fac 100644 --- a/src/lua.c +++ b/src/lua.c @@ -353,14 +353,14 @@ void save_image(lua_State *L) { /* death and rebirth */ char *Script_name = NULL; char **Argv = NULL; -extern void edit(char *filename, const char *status); +extern void edit(lua_State *L, char *filename, const char *status); void switch_to_editor(lua_State *L, const char *message) { endwin(); if (Script_name) - edit(Script_name, message); + edit(L, Script_name, message); else { write_definition_to_file(L, "main", "teliva_editbuffer"); - edit("teliva_editbuffer", ""); + edit(L, "teliva_editbuffer", ""); char new_contents[8192] = {0}; read_contents(L, "teliva_editbuffer", new_contents); update_definition(L, "main", new_contents); |