benrhughes / todotxt.net

An implementation of todo.txt for Windows using the .NET framework
http://benrhughes.github.io/todotxt.net/
Other
500 stars 123 forks source link

Do not remove leading whitespace #219

Closed chipbite closed 9 years ago

chipbite commented 10 years ago

Related to #218 (do not remove empty lines), this concerns leading whitespace within the line, which is also removed by todotxt.net

Like in discussion of #218, this handling of whitespace comes out of expected behavior, and I don't think that there is anything explicitly said in the todo.txt spec about it.

Reproduce:

  1. Create todo.txt file, and add leading whitespace / indents. Example
Do last things for @move to new house
  Mail +mom with new house address after @move
  Schedule +painter-mike for fence after @move to new house
Get @robot lawnmower
  Buy @robot lawnmower
  Set up delineating wire for @robot
  1. Open in todotxt.net, add a task, save
  2. Reopen in editor.

Expected: Task added at end, no other changes. Actual: Task added at end, leading whitespace removed.

Piscean commented 9 years ago

I understand the request to not strip whitespace, and have a potential solution to make that happen.

What I don't understand is how to use it. Are you creating/editing the todo.txt file in an editor, or with todotxt.exe? I can't get all the tasks to line up correctly per project like you have in the above example unless I edit the file with an editor. How are you sorting to get that display? (Assuming white space doesn't get stripped.)

Thanks.

chipbite commented 9 years ago

Hi! Sorry for delay in replying! Yes, I am using a text editor. I am sorting using different tools.

The purpose of whitespace - both w r t empty lines and blanks/tabs - is for me to be able to have a structure in the file that makes for easy viewing of the todo.txt file contents. This will be valuable for one or perhaps some approaches/workflows, certainly not all.

What is likely central to understanding this need is the realization that the format and file is shared, that users are using more than one way of accessing the todo.txt file. Enabling this sharing amongst tools obviously means respecting the syntax, but being a good toolchain citizen I feel would also include not modifying the source file more than necessary.

So, respecting the format syntax is one thing, but removing contents and other modifications is what this issue (and lines, #218) is about.

For my toolset: So I use a text editor for editing and overview reviewing/processing, i e: quickly adding many tasks and quickly prioritizing groups of tasks. I occasionally use todo.txt cli for viewing (sorting) and adding the odd task. Most often, for using the list (adding a task on the go, viewing/filtering/sorting, completing tasks and archiving) I use use todotxt.net and simpletask on my android devices.

For me, #218 is more important, but both are independently valuable to me.

I hope this clarifies and helps. I very much appreciate you taking your time to look at this request, I think that together with #218 this would make the user experience todotxt.net as a more predictable and reliable tool.

mjdescy commented 9 years ago

@Piscean Please make preserving whitespace (leading spaces and blank lines) an option, so the current behavior isn't changed unless users want it to be. Users (like me) who primarily sort or filter the list will not necessarily benefit from preserved whitespace.

mjdescy commented 9 years ago

@chipbite When you use Todo.txt, do you primarily use the "Order in file" sort option? Also, todotxt.net doesn't have a method to insert a task at a specific place in the file, or to move tasks up or down in the file, so your in-app options for organizing based on whitespace are limited.

Piscean commented 9 years ago

Thanks for the clarification. I'll get on this as time permits.

Piscean commented 9 years ago

@chipbite I checked in a change tonight which will allow preserving white space when adding/deleting tasks. I've been using the code for the last week and it seems to work as I think you want it to. If you find places you are still losing white space, please give me repro steps so I can track those cases down.

My changes don't address the preservation of blank lines. That's next on the agenda.

chipbite commented 9 years ago

@Piscean - Cool! I look forward to checking it out!

benrhughes commented 9 years ago

Oh, just one thing while I remember - in you commit message, if you put 'Closes #219' or 'Fixes #219' github will automatically associate the commit with the issue, and close it. I usually change it when I accept the pull request, but forgot this time.

Piscean commented 9 years ago

I'll do my best to keep that in mind. Sorry for the extra work. Eric

Date: Wed, 10 Dec 2014 05:02:47 -0800 From: notifications@github.com To: todotxt.net@noreply.github.com CC: c_frames@hotmail.com Subject: Re: [todotxt.net] Do not remove leading whitespace (#219)

Oh, just one thing while I remember - in you commit message, if you put 'Closes #219' or 'Fixes #219' github will automatically associate the commit with the issue, and close it. I usually change it when I accept the pull request, but forgot this time.

— Reply to this email directly or view it on GitHub.

                  =
benrhughes commented 9 years ago

No problems at all - I forget half the time too :) I just figure the more of us that know about it, the more likely it is to happen.

On Thu, Dec 11, 2014 at 3:34 AM, Piscean notifications@github.com wrote:

I'll do my best to keep that in mind. Sorry for the extra work. Eric

Date: Wed, 10 Dec 2014 05:02:47 -0800 From: notifications@github.com To: todotxt.net@noreply.github.com CC: c_frames@hotmail.com Subject: Re: [todotxt.net] Do not remove leading whitespace (#219)

Oh, just one thing while I remember - in you commit message, if you put 'Closes #219' or 'Fixes #219' github will automatically associate the commit with the issue, and close it. I usually change it when I accept the pull request, but forgot this time.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/benrhughes/todotxt.net/issues/219#issuecomment-66480033 .