diff options
-rw-r--r-- | src/kilo.c | 2 | ||||
-rw-r--r-- | src/lua.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/kilo.c b/src/kilo.c index dab7d96..365b8d7 100644 --- a/src/kilo.c +++ b/src/kilo.c @@ -1197,7 +1197,7 @@ void editorGo(lua_State* L, int fd) { if (qlen != 0) query[--qlen] = '\0'; } else if (c == ESC || c == ENTER) { editorSetStatusMessage(""); - if (c == ENTER && definition_exists(L, query)) { + if (c == ENTER) { Current_definition = query; write_definition_to_file(L, Current_definition, "teliva_editbuffer"); editorClear(); diff --git a/src/lua.c b/src/lua.c index 9b7cd76..08c5f92 100644 --- a/src/lua.c +++ b/src/lua.c @@ -323,9 +323,9 @@ void write_definition_to_file (lua_State *L, char *name, char *outfilename) { lua_getfield(L, -1, name); const char *contents = lua_tostring(L, -1); lua_pop(L, 1); - if (contents == NULL) return; int outfd = open(outfilename, O_WRONLY|O_CREAT|O_TRUNC, 0644); - write(outfd, contents, strlen(contents)); + if (contents != NULL) + write(outfd, contents, strlen(contents)); close(outfd); } @@ -372,7 +372,7 @@ void switch_to_editor (lua_State *L, const char *message) { else { Current_definition = "main"; write_definition_to_file(L, Current_definition, "teliva_editbuffer"); - edit(L, "teliva_editbuffer", ""); + edit(L, "teliva_editbuffer", /*status message*/ ""); char new_contents[8192] = {0}; read_contents(L, "teliva_editbuffer", new_contents); update_definition(L, Current_definition, new_contents); |