Open smichel17 opened 4 years ago
This bothers me as well in this great app. I looked through the code how to implement this. What is the purpose of the WhitespaceToken in the first place?
Whitespace token is needed to reconstruct the task and all the whitespace after it has been tokenized
Also needs to be done when adding due or threshold dates.
Being a newbie on the Android/NextCloud version (on Sailfish OS), I like the someday/maybe label of this issue.
However, I like the idea of clean lines. There was a discussion back in the day on #51
https://github.com/mpcjanssen/simpletask-android/issues/51#issue-28240753
Is there a way to run a
text = text.replace(/\s{2,}/g, ' ') // cleanup multiple whitespaces
(via Zutun.txt, a native todo.txt for Sailfish OS: https://github.com/fuchsmich/zutun.txt/pull/35/commits/ccdf64dd851a3b0a7235085088f485edcb360f1c#
)
Terrible workaround:
Add the following to your main lua config (NOT in the script
section of the filter):
function onAdd(t)
return string.gsub(t, "%s+", " ")
end
What it does: Whenever you add a task, any amount of whitespace (spaces & tabs) will be replaced by a single space. So any double spaces will be replaced with a single one.
Limitations: Doesn't work for editing a task, only adding a new task.
Is there a function onChange or onEdit this could be applied to additonally?
Workaround, yes - anyhow, I appreciate the idea.
I don't think so. They could be added, but of course also this bug could be fixed :P
Hmja, I agree - partly ;-). Of course adding and then removing in the next step takes efforts a) for adding and b) for removing something. Whitespaces, in this case.
However, I guess (yes, guess) it is hard to add @context and +project tags without "sourrounding" whitespaces, as those tags may appear anywhere in the string of a task. When adding _@acontext, the _@acontext does not - and IMHO cannot - "know" where it is placed, and what kind of string lies behind or ahead of it. The "final" string=task can.
My suggestion is: leave the "add project/context" functions unchanged. Let them create double (or even triple, ...) whitespaces. Clean up when finally saving the string - no matter if first time saved (created) or afterwards (edited).
What do you think?
(Lot of comment for a minor priority issue, I know ;-).)
Right now if the task ends in a space, adding a list or tag will still prepend a space, resulting in a double space.
Low priority; just clearing this out of my personal task list.