summaryrefslogtreecommitdiff
path: root/editmode.c
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-04-13 18:40:47 +0200
committerOskar <[email protected]>2024-04-13 18:40:47 +0200
commitcfe7a2d4b3dd25ce9577417416e6313572e9e2ea (patch)
tree0b9bec226103ef43fde6899a324d358249952895 /editmode.c
parent8454a5c30c8f5f17abd377965b61dc0786a08800 (diff)
x implemented and d partially implemented
Diffstat (limited to 'editmode.c')
-rw-r--r--editmode.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/editmode.c b/editmode.c
index 149a158..759f9d5 100644
--- a/editmode.c
+++ b/editmode.c
@@ -226,6 +226,25 @@ int remove_line_contents(char *filename, uint64_t focus) { // removes contents o
}
+int remove_line_contents_and_newline(char *filename, uint64_t focus) {
+
+ int increment = 0;
+ if (focus == 1) { // checks if its line 1. This is so that we can remove the newline properly.
+ increment++;
+ }
+ int rlc = remove_line_contents(filename, focus);
+ if (rlc == 1) {
+ return 1;
+ }
+
+ int dsn = delete_specified_newline(filename, focus+increment);
+ if (dsn == 1) {
+ return 1;
+ }
+
+ return 0;
+}
+
int editmode(char filename[], uint64_t focus) { // the editing interface
char *line;
@@ -252,7 +271,6 @@ int editmode(char filename[], uint64_t focus) { // the editing interface
return 0;
}
- fprintf(stdout, "Do you want to write the changes?\n");
int yesno = choice();
if (yesno == 1) {