VladimirMarkelov / ttdl

TTDL - Terminal Todo List Manager
MIT License
210 stars 17 forks source link

Problem when addind a todo #44

Closed manfredlotz closed 3 years ago

manfredlotz commented 3 years ago

If I do this

ttdl add "Call my grandma at 14:30h @phone due:1d"

I get

e:1d"
Added todo:
 # D P Created    Finished   Due        Subject
------------------------------------------------
59                           2021-01-22 Call my grandma at @phone 14:30h

Of course I like to see

9                           2021-01-22 Call my grandma at 14:30h @phone

Is this a bug on ttdl's side or am I the problem?

VladimirMarkelov commented 3 years ago

It took some time to understand what was the trouble. In this particular case, the fix may be inconvenient, but you can replace : inside time with h (internally 14:30 becomes a tag 14 with value 30):

ttdl add "Call my grandma at 14h30 @phone due:1d"

As I debugged, the cause of the trouble is that the used library, when parsing, extracts all the tags without preserving the original string. When it generates a line for an item, it adds all tags at the end. I think, I understand why it was done this way. Usually it does not make much difference where a tag is. But, in some cases, like yours, that behavior may distort the original todo item meaning. A todo item that contains more than one tag can turn into incomprehensible sentence. E.g, ttdl add "call person:john at 14:30 to ask about agreement with customer:initech" becomes call at to ask about agreement with person:john 14:30 customer:initech.

I'll look into the issue. I think it must be fixed.

manfredlotz commented 3 years ago

Excuse me for not better explaining the issue.

For the time being I avoid the : (colon). I agree this should be fixed.

VladimirMarkelov commented 3 years ago

Replaced the "todotxt" library with another one that preserves tags in todo's subject. There are a few incompatibilities(and may be new bugs), so I bumped version to 2.0.

manfredlotz commented 3 years ago

Did some tests. All looks good. Thanks a lot