mpcjanssen/simpletask-android

11.0.0 cloudless: all completed tasks in one line at the end of done.txt

J70P opened this issue · 8 comments

J70P commented

Hello,

version 11.0.0 cloudless stores all completed tasks in one line at the end of done.txt.

Example:

testing due:2022-07-23

goes into done.txt as "x 2022-07-23 testing due:2022-07-23" at the end of the last line in done.txt.

If it's important, I have disabled "Windows-friendly line breaks".

This bug annoys me because I have a todo application on PC that synchronizes with the todo.txt and done.txt files, but:

  • automatic archiving is unusable: all tasks are on the same line in done.txt.
  • so I use manual archiving but - still the same bug - the first finished task of the list will be on the same line as the last one of the previous list.

The only way to have a non-corrupted done.txt is to delete it after each archiving.

I'm guessing this must be caused by e1f4550#diff-e2fcf25ef113c13520402bbd7354a44fe22db1abe34fa09435b693d879c08751L106-R106, it's the only related piece of code that has changed in the last few years.

@regexgit what OS are you using on the PC?

Both linux and windows but there is no \r or \n at all, here is an exemple with 2 completed tasks Test1 and Test2 in done.txt, I checked in hex editor on android: there is no character between the 2 tasks:

x 2022-09-06 Test1x 2022-09-06 Test2

Just to confirm, if you follow these steps:

  • Create 3 tasks
    2022-09-06 Test1
    2022-09-06 Test2
    2022-09-06 Test3
    
  • Archive Test1
  • Archive Test2 and Test3 at the same time

Is the result:

  1. This:

    x 2022-09-06 Test1x 2022-09-06 Test2
    x 2022-09-06 Test3
    
  2. Or this:

    x 2022-09-06 Test1x 2022-09-06 Test2x 2022-09-06 Test3
    

If I understood the description above correctly, it's (1).

Yes, case 1

I think I know what's happening. The appendToFile function doesn't add a trailing eol so the next archive will be joined in the same line.

@regexgit cloudless builds at https://mpcjanssen.nl/artifacts/master/ have this issue fixed