summaryrefslogtreecommitdiff
path: root/editmode.c
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-04-19 23:18:03 +0200
committerOskar <[email protected]>2024-04-19 23:18:03 +0200
commit73b0414254e6b888656b4e5346292f27b67ac9d9 (patch)
tree1427052e0515364278638d270755d213768d45c4 /editmode.c
parent645a02d84b174376beed51de9e8820fe4d217ede (diff)
Added a way for the program to check if file exists or not. If not then
it creates it. If changes are made to the file like writing newlines or edits from editmode is written then it will create the file.
Diffstat (limited to 'editmode.c')
-rw-r--r--editmode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/editmode.c b/editmode.c
index f552f4a..3ed80be 100644
--- a/editmode.c
+++ b/editmode.c
@@ -6,6 +6,8 @@
#include "7ed.h"
#include <stdint.h>
+extern uint8_t new;
+
int delete_specified_newline(char filename[], long focus) { // special version of write_line that does as the name says
char *line;
@@ -277,6 +279,7 @@ int editmode(char filename[], uint64_t focus) { // the editing interface
return 0;
}
+ new = 0;
size_t editbuffer_size = strlen(editbuffer);
write_line(filename, focus, editbuffer, editbuffer_size);