sleek icon indicating copy to clipboard operation
sleek copied to clipboard

Position of context and project tags should be respected in file

Open thewholelifetolearn opened this issue 2 years ago • 12 comments

Describe the bug When project tags and/or context tags are used in the task, they appear in Sleek at the end of the line but also in the saved file

To Reproduce Steps to reproduce the behavior:

  1. Create a new task with context and project tags in the text
  2. Valid the form
  3. Open the todo file in a text editor (for example Notepad++)
  4. The input isn't respected in the file. The tags are at the end.

Expected behavior At least the file should respect what the user entered in the form. The tags should be placed as written by the user.

Screenshots Entering task Display in Sleek Content of file

Desktop (please complete the following information):

  • OS: Windows 10
  • Version of sleek : 1.1.9
  • Source: Github

thewholelifetolearn avatar Apr 20 '22 15:04 thewholelifetolearn

@thewholelifetolearn thanks for pointing it out. Unfortunately there is nothing we can do at this moment, as the parsing is done by a library, which doesn't respect the arrangements in the file. There is an issue here and also in the respective library: https://github.com/ransome1/sleek/issues/68

ransome1 avatar Apr 20 '22 16:04 ransome1

There is indeed already an issue in Sleek regarding the position in the display. My issue is about the position in the file. Sleek is a tool mostly to display the content of the file. It should not alter the content. In this case, the content of the file is not what I have submitted. That means that even if I use an other tool on the same or other platform, the display will stay incorrect. In my opinion, Sleek can alter the display of the content to highlight informations but it should not alter the content.

thewholelifetolearn avatar Apr 21 '22 05:04 thewholelifetolearn

Seems identical to other issue referred to. However I agree that sleek actually changing entries to shift text would be a disaster. It would turn natural text entries from other software or text editor to gobbledegook. Ask @george about @peter gift Is destroyed in meaning

aubreyz avatar Apr 21 '22 11:04 aubreyz

Complete disaster. Opened my todo.txt once with sleek and all entries scrambled already. Quite a lot turned from readable into a riddle.

Edit for clarity: I agree that sleek just showing it that way would not be a problem, but it rewrote my whole todo.txt.

aurisnoctis avatar Jun 27 '22 12:06 aurisnoctis

I'll take another look into what we can do about it and put it on the backlog.

ransome1 avatar Jun 30 '22 21:06 ransome1

@aubreyz @aurisnoctis @thewholelifetolearn We can approach this step by step.

First we should limit the file writing in order to just edit single lines and not the whole file. But as long as we're using the jsTodoTxt library for parsing, newly added todos or todos, that are edited, will continue being rearranged.

I did some minor changes to the file handling in sleek and created a pre-release. This release should not alter your todos, unless you edit a single one of them. In this case the todo will be rearranged and written to file. The same goes for new todos. Please feel free and help me give it some proper testing, you can download the release here: https://github.com/ransome1/sleek/releases/tag/v1.2.2-rc.2

Be aware that there is still work to be done on the archiving function. Archiving still does alter the whole todo.txt file according to jsTodoTxt specs.

Second, I'm still hoping there will be some work on this anytime soon at jsTodoTxt. Here is the corresponding issue in case you want to be in the loop: https://github.com/jmhobbs/jsTodoTxt/issues/5

ransome1 avatar Jul 01 '22 16:07 ransome1

Hi @ransome1 and thanks for the quick test version.

Indeed, the order of words and symbols in the existing lines in the todo.txt are now preserved. New tasks created in sleek are still scrambled directly after saving them to the todo.txt file.

The upper "anna" line was created in the new version of sleek, the lower line was typed with an editor directly into the todo.txt file. The rearrangement to the end of the line seems to leave too many blanks behind.

Selection_20220702_21:21:37

"Bert" line as shown in sleek Selection_20220702_21:48:04

In the todo.txt, the lines not created with sleek remain in the correct order so far, also after a new start and also after starting to edit a line, but cancelling the process.

aurisnoctis avatar Jul 02 '22 20:07 aurisnoctis

@aurisnoctis in order for the rest to work, we need to wait until jsTodoTxt has been enhanced unfortunately.

ransome1 avatar Jul 03 '22 07:07 ransome1

Ok, for the moment I am back to https://github.com/QTodoTxt/ but will keep an :eye: on you every now and then. Thanks again for your quick response!

aurisnoctis avatar Jul 04 '22 15:07 aurisnoctis

I haven't yet dug through the code and understood how the parser is used in sleek, but in Markor, we just keep the todo item string intact through parsing. Would it be possible to do this in sleek too? i.e. for each line, parse using the js library to extract the contexts, due date etc etc while keeping a copy of the full task string. It isn't a full fix - changing the task will still result in it being re-written with the contexts and projects in the end, but tasks which are not modified will be unaffected.

harshad1 avatar Jul 11 '22 18:07 harshad1

@harshad1 yes this is possible and actually one of the solutions I've been looking into already. As I'm afk at the moment I can only continue working on this from October on. So please stay tuned.

ransome1 avatar Sep 16 '22 14:09 ransome1

Awesome. I can try to help, but I have basically zero JS experience, so I'm not sure how useful I'll be.

Sep. 16, 2022 07:39:48 ransome @.***>:

@harshad1[https://github.com/harshad1] yes this is possible and actually one of the solutions I've been looking into already. As I'm afk at the moment I can only continue working on this from October on. So please stay tuned.

— Reply to this email directly, view it on GitHub[https://github.com/ransome1/sleek/issues/370#issuecomment-1249454365], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAOZ3TELL3TEWRBNZZXCYY3V6SBDHANCNFSM5T4PZEZA]. You are receiving this because you were mentioned.[Tracking image][https://github.com/notifications/beacon/AAOZ3TGHQQDDXVQCEBIMWJLV6SBDHA5CNFSM5T4PZEZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJJ4SSHI.gif]

harshad1 avatar Sep 16 '22 19:09 harshad1

@thewholelifetolearn @harshad1 @aurisnoctis @aubreyz

I looked into it a bit further and applied some changes. The issue has not been fully solved, though.

In this pre release sleek will not rearrange todos anymore if you just open and rewrite them using the interface. The only times todos will be put into the todo.txt parser (this is the part where todos are being altered, unfortunately) is when you

  • use the date pickers and the priority picker
  • mark todos as complete or incomplete
  • archive completed todos
  • rename or delete filters (in the filter drawer)

As you see there is still work to do, but the most critical issues have been solved – theoretically.

I could need some help of you guys on the testing. It would mean a lot to me, if you could download the latest pre-release (https://github.com/ransome1/sleek/releases/tag/v1.2.2-rc.4), backup your data and start testing the changes.

ransome1 avatar Sep 29 '22 13:09 ransome1

Hi @ransome1 ! Thanks for working on the issue. I am back on https://github.com/QTodoTxt (QTodoTxt2, the re-write of it), contributed some code there and that satisfies my needs completely at the moment.

aurisnoctis avatar Sep 29 '22 13:09 aurisnoctis

First impression is very good! Word order keeps fine. And of course it would be great, if sometimes in the future even the display keeps the order :-) Thank you!

aisbergde avatar Sep 29 '22 16:09 aisbergde

First impression is very good! Word order keeps fine. And of course it would be great, if sometimes in the future even the display keeps the order :-) Thank you!

I agree, but there is so much else to do before I could take care of that. But stay tuned.

ransome1 avatar Sep 29 '22 21:09 ransome1

At least the file should respect what the user entered in the form. The tags should be placed as written by the user.

This should now be happening in 1.2.2.

I'm closing here. If you find any issues, let's discuss them here and reopen if necessary.

ransome1 avatar Oct 02 '22 08:10 ransome1