todo.txt-cli icon indicating copy to clipboard operation
todo.txt-cli copied to clipboard

New tasks being added to old lines

Open AdamBD opened this issue 5 years ago • 3 comments

Do you want to request a feature or report a bug? Bug

What is the current behavior? Sometimes when adding tasks they are not added as new lines in the file but appended to some previous line

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior? Each addition will be added to a new line in the file

Which versions todo.sh are you using? TODO.TXT Command Line Interface v2.12.0

Which Operating System are you using? MacOS BigSur 11.2.1

Which version of bash are you using? zsh 5.8 (x86_64-apple-darwin20.0)

AdamBD avatar Apr 30 '21 08:04 AdamBD

The core todo.sh has tests that ensure that this does not happen. It could be a misbehaving add-on that you're using, or are you "sometimes" editing the file in another editor? Some editors omit a final newline in the last line (especially on Windows), or this could also be caused by mismatching line endings (a.k.a. CR-LF vs. LF).

inkarkat avatar Apr 30 '21 19:04 inkarkat

@inkarkat thanks for replying! I am indeed using another client in addition. I am using a mac client called sleek (https://github.com/ransome1/sleek), but the behavior I see can happen when just using this CLI. Any advice on ways to enforce the same line behavior?

AdamBD avatar May 01 '21 12:05 AdamBD

Some clients have a setting (like Windows-friendly line breaks in Simpletask) to influence the behavior. But it would seem that such a mismatch would result in very reproducible corruption (e.g. whenever I add a task in the other client, todo.sh will then append to that if I use it next).

So maybe you could closely monitor when such corruption occurs for some time, and try to find a way to reproducibly cause corruption. As I said, just by using todo.sh itself (i.e. without synchronization of the todo.txt file and maybe another client running concurrently), I doubt that such problems can occur, and it's far more likely to be caused by something in the environment. Nonetheless, if you can find a reproducible example, we'll surely look into it.

inkarkat avatar May 01 '21 14:05 inkarkat