From cfe7a2d4b3dd25ce9577417416e6313572e9e2ea Mon Sep 17 00:00:00 2001 From: Oskar Date: Sat, 13 Apr 2024 18:40:47 +0200 Subject: x implemented and d partially implemented --- editmode.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'editmode.c') 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) { -- cgit v1.2.3