diff options
author | Oskar <[email protected]> | 2024-04-20 16:27:55 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-04-20 16:27:55 +0200 |
commit | b3d8be14e12aca5993925c156da5eb76af88e665 (patch) | |
tree | 0e9f01bcce336ebdc6b53575f2e1d082a69313d3 | |
parent | a5b0a8dd423fd15d133645987f21a3e87f5fa606 (diff) |
Fixed issue where files with no lines dont work properly with 'N'
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | editmode.c | 8 | ||||
-rwxr-xr-x | test/nl.sh | 2 |
3 files changed, 10 insertions, 2 deletions
@@ -1,4 +1,4 @@ TODO list. This is mostly so i can plan more granularly and remember small stuff i was working on last time and what i should prioritise first. This is not my overall big planning board. (1 highest prio, 10 lowest) -1 - remove_line_contents more efficient. Maybe allow specifying amount of lines to add so we dont need to call the function too many times. +1 - Make remove_line_contents more efficient. Maybe allow specifying amount of lines to add so we dont need to call the function too many times. @@ -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; + } } } @@ -1,5 +1,7 @@ #!/bin/bash +#Regen 'newlinetest' file so i dont have to manually repair it to its original state + filename="testgrounds/newlinetest" rm -f $filename |