mpcjanssen / simpletask-android

GNU General Public License v3.0
546 stars 125 forks source link

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

Closed J70P closed 2 years ago

J70P commented 2 years ago

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".

regexgit commented 2 years ago

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

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

smichel17 commented 2 years ago

I'm guessing this must be caused by https://github.com/mpcjanssen/simpletask-android/commit/e1f4550b6d54bedc9b3d3b986eaf943ea1d44a35#diff-e2fcf25ef113c13520402bbd7354a44fe22db1abe34fa09435b693d879c08751L106-R106, it's the only related piece of code that has changed in the last few years.

mpcjanssen commented 2 years ago

@regexgit what OS are you using on the PC?

regexgit commented 2 years ago

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

smichel17 commented 2 years ago

Just to confirm, if you follow these steps:

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).

regexgit commented 2 years ago

Yes, case 1

mpcjanssen commented 2 years ago

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.

mpcjanssen commented 2 years ago

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