ransome1 / sleek

todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)
https://github.com/ransome1/sleek/wiki
MIT License
1.45k stars 113 forks source link

Missing Final New Line in `todo.txt` #730

Open nikbucher opened 3 months ago

nikbucher commented 3 months ago

The current implementation does not append a final newline character when saving the todo.txt file. This behavior causes issues with the standard todo.txt CLI, which expects a final newline in the todo.txt file. As a result, a new task added by the CLI are appended to the last task instead of being placed on a new line.

Steps to Reproduce:

  1. Save a todo.txt file using the current implementation.
  2. Add a new task using the standard todo.txt CLI.
  3. Notice that the new task is appended to the last task instead of being placed on a new line.

Expected Behavior: A final newline character is added when the todo.txt file is saved, ensuring compatibility with the standard todo.txt CLI.

Suggested Fix: Modify the writeToFile method to ensure that a final newline character is added when writing the todo.txt file here: https://github.com/ransome1/sleek/blob/c3fceeae7664490a80f3c5c7881bade658eca9cf/src/main/modules/File/Write.tsx#L9-L12

That would be great. Thanks a lot in advance.

Best regards - Nik