todotxt / todo.txt-cli

☑️ A simple and extensible shell script for managing your todo.txt file.
http://todotxt.org
GNU General Public License v3.0
5.55k stars 712 forks source link

duplicate contexts or projects #430

Closed tune007 closed 6 months ago

tune007 commented 6 months ago

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

What is the current behavior? duplicate contexts and projects listed when using todo.sh listproj or listcon

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. when the context or the project name is at the end of a line without a space it is not picked up in meta colors and they are listed as duplicates

What is the expected behavior? when adding a +project or @context at the end of the line there should not be a need to add a space as well for projects and contexts to display correctly

Which versions todo.sh are you using?

Run todo.sh -V

Which Operating System are you using? v2.12.0

Which version of bash are you using?

Run bash --version 5.1.16

inkarkat commented 6 months ago

I've just written an automated test to investigate. This is the content of todo.txt, and it seems to be working as expected; listproj just outputs +flowers and +roses once.

+roses +flowers
+roses and only +flowers
(B) +roses prioritized +flowers
(B) 2024-02-21 +roses prioritized +flowers
x 2024-02-21 2024-02-19 +roses done +flowers
+roses +flowers at the front
  +roses +flowers at the front with leading space
my +flowers are +roses in the middle
at the back pick the +roses +flowers
at the back with trailing space +flowers +roses 

Have I misunderstood the problem?

tune007 commented 6 months ago

Thanks copied your text and works fine in termux original issue was on wsl2 where I use todotxt for work. This is why I have logged an issue. Whenever I uses e.g. +roses(no space) or @garden(no space) at end of a line and say for instance @garden (with trailing space) I will get 2 @garden contexts in listcon.

On 21 February 2024 16:34:58 SAST, Ingo Karkat @.***> wrote:

I've just written an automated test to investigate. This is the content of todo.txt, and it seems to be working as expected; listproj just outputs +flowers and +roses once.

+roses +flowers
+roses and only +flowers
(B) +roses prioritized +flowers
(B) 2024-02-21 +roses prioritized +flowers
x 2024-02-21 2024-02-19 +roses done +flowers
+roses +flowers at the front
 +roses +flowers at the front with leading space
my +flowers are +roses in the middle
at the back pick the +roses +flowers
at the back with trailing space +flowers +roses 

Have I misunderstood the problem?

-- Reply to this email directly or view it on GitHub: https://github.com/todotxt/todo.txt-cli/issues/430#issuecomment-1956787383 You are receiving this because you authored the thread.

Message ID: @.***>

inkarkat commented 6 months ago

works fine in termux original issue was on wsl2

@tune007 That smells like a line-ending issue. Could it be that the todo.txt on Windows uses CR-LF line endings? The Unix toolchain of todo.sh would then process both +roses (when followed by whitespace) and +roses␍ (trailing CR; when at the end of the line) separately.

You can check (on WSL) with either $ file path/to/todo.txt or $ hd path/to/todo.txt (the latter will show 0d 0a at the end of each line if it's CR-LF).

The todo.txt file needs to use Unix (LF) line endings for todo.sh; most Windows tools handle that as well.

tune007 commented 6 months ago

Thanks for your response I opened the file with notepad++ and found some crlf line endings not sure why this is happening sometimes cause last test did not do it. I have created a fish function to run todo.sh so I will just run dos2unix to cleanup everytime I call the function thanks a stack for the quick response. One less thing on my todotxt list.

Regards Eugene van den Bergh

On 21 February 2024 23:09:42 SAST, Ingo Karkat @.***> wrote:

works fine in termux original issue was on wsl2

@tune007 That smells like a line-ending issue. Could it be that the todo.txt on Windows uses CR-LF line endings? The Unix toolchain of todo.sh would then process both +roses (when followed by whitespace) and +roses␍ (trailing CR; when at the end of the line) separately.

You can check (on WSL) with either $ file path/to/todo.txt or $ hd path/to/todo.txt (the latter will show 0d 0a at the end of each line if it's CR-LF).

The todo.txt file needs to use Unix (LF) line endings for todo.sh; most Windows tools handle that as well.

-- Reply to this email directly or view it on GitHub: https://github.com/todotxt/todo.txt-cli/issues/430#issuecomment-1957942809 You are receiving this because you were mentioned.

Message ID: @.***>

inkarkat commented 6 months ago

Alright, dos2unix in a wrapper sounds like a good solution. I'm closing this issue then. Have fun with todo.txt!

tune007 commented 6 months ago

hi Ingo sorry for contacting you on a unrelated thread, a few years ago I bought the todotxt mobile app as displayed on the original todotxt.org website. Is there a way I can get the app somewhere again ? How do I install it on my phone ?

regards Eugene van den Bergh

On 22 February 2024 13:42:11 SAST, Ingo Karkat @.***> wrote:

Alright, dos2unix in a wrapper sounds like a good solution. I'm closing this issue then. Have fun with todo.txt!

-- Reply to this email directly or view it on GitHub: https://github.com/todotxt/todo.txt-cli/issues/430#issuecomment-1959276967 You are receiving this because you were mentioned.

Message ID: @.***>

inkarkat commented 6 months ago

Hello Eugene, Gina's original todo.txt app for Android has been discontinued after incompatible changes in the Dropbox API; nobody signed up to update the app's code. Since then, I've been using Simpletask (Nextcloud version, but before that existed I also used the cloudless variant where you had to set up the sync through another app). There have been very few updates, and just this month the author has made his GitHub repo read-only (but the app still works right now; just don't expect any more updates). A few more alternatives are listed on the todotxt.org page.