Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Final New Line in todo.txt #730

Open
nikbucher opened this issue Aug 23, 2024 · 0 comments
Open

Missing Final New Line in todo.txt #730

nikbucher opened this issue Aug 23, 2024 · 0 comments

Comments

@nikbucher
Copy link

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:

function writeToFile(string: string, filePath: string, bookmark: string | null) {
const stopAccessingSecurityScopedResource = (process.mas && bookmark) ? app.startAccessingSecurityScopedResource(bookmark) : null;
fs.writeFileSync(filePath, string, 'utf-8');

That would be great. Thanks a lot in advance.

Best regards - Nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant