summaryrefslogtreecommitdiff
path: root/editmode.c
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-04-20 16:27:55 +0200
committerOskar <[email protected]>2024-04-20 16:27:55 +0200
commitb3d8be14e12aca5993925c156da5eb76af88e665 (patch)
tree0e9f01bcce336ebdc6b53575f2e1d082a69313d3 /editmode.c
parenta5b0a8dd423fd15d133645987f21a3e87f5fa606 (diff)
Fixed issue where files with no lines dont work properly with 'N'
Diffstat (limited to 'editmode.c')
-rw-r--r--editmode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/editmode.c b/editmode.c
index b5aa770..14485d3 100644
--- a/editmode.c
+++ b/editmode.c
@@ -178,7 +178,13 @@ int new_line(char filename[], long long new_line_pos_temp, uint64_t amount_of_li
fputc('\n', file);
fputc('\n', file);
fclose(file);
- return 0;
+
+ if(amount_of_lines == 1) {
+ return 0;
+ }
+ if(amount_of_lines > 1) {
+ amount_of_lines = amount_of_lines-1;
+ }
}
}