Closed platers closed 3 years ago
whoah, that's cool! I will try/look at it sometime soon. I didn't understand your notes about cloning logic though, could you explain?
the cloning logic is how the clones are maintained. Currently the clones are only updated when a tag is added or deleted from a row, or when the tag root is deleted. This allows the user to mess around in the tag root, and the cloned rows might get out of sync with the actual rows with that tag. The only way to refresh the tag root is to delete it then tag a new row. Also in this scheme, rows are not deleted from the tag root even if that row no longer exists elsewhere in the document.
I could imagine another scheme where the tag roots are refreshed all the time to make sure they are always in sync. Then the user wouldnt be able to change much in the tag root.
I see, if the tags are non-unique then I don't think they should share cloned children. if you want that functionality, you should instead just clone a row with marks and have them as children, i think?
hmm I'm not sure what you mean. I think the tags should share cloned children. If I tag a row #todo and #urgent I want that row to show up in both the #todo and #urgent roots.
ahh, i see. interesting! it's a cool feature, not what i had in mind
your logic soudns good. what happens if you add a child to the tag root? (seems fine if nothing happens)
yep nothing happens. My goal was to generalize #300. Now that I think about it, a tag search where you search for a tag and it returns the rows might be useful to for easier navigation. Not sure if that should be an additional feature or if it should replace cloning.
yeah, the version of tags i had imagined in the past was:
however, your version is nice since searching isn't as good as seeing them all in one place
perhaps the basic version of tags can be a core feature of vimflowy, and then the extra feature of adding marks for each unique tag with cloned children could be a plugin (called "Tags To Mark" or something)
what do you think?
that sounds good to me! I'll work on that.
should be ready to try now. Search tags with '-'. Tag cloning is now another plugin.
awesome. will take a look over the weekend
addressed all your comments, let me know if you want more tests. Also I added a test-windows command in package.json to run unit tests on windows.
tested briefly.
found some bugs in tag clone, working on fixes
nice!
that's too bad about the deleting tags... why does the hanging 1 freeze the doc? (most likely my fault, i just don't remember the code)
when i delete a tag then undo, it goes to a new position. however, redo still works - i guess because the mutation stored is by tag name and not index. this seems fine to me, seems a bit tricky overall and scary since undo doesn't quite restore the document to exactly the same state... not necessarily problematic right now though but it would be if there was also something that relied on tag indices
here's what i see for linting:
hm, so what happens if in the d# shortcut you just don't wait for a number if there's exactly one tag?
it made it freeze after repeating d#1 with '.' I'm not sure exactly why
ok I'll try it real quick
hmm it's a tricky bug in my code...
i pushed a fix to master, so something like this should no longer cause hangs
nice! The shortcut seems to work now but some of the unit tests now fail. The 'can repeat' test gives 'Error: Queue stopped: queue is stopped!!'. Is there a difference between real use and sendKeys?
it seems to pass for me, could you push the latest tests to your branch?l
I just added the shortcut, no changes to the tests.
on line 66, this needs to change:
t.sendKeys('kd#1');
to
t.sendKeys('kd#');
otherwise it's waiting for something after the 1
oh that makes sense. 'can repeat' seems to have a different issue. d#1. works when I try it manually, but the test case is giving the queue is stopped error.
you were right, there was a weird issue affecting unit tests but not the browser. it's fixed now on master. in addition to that, i had these changes, after which tests pass! https://github.com/WuTheFWasThat/vimflowy/commit/8f073e6b2c65d03b9d7083e7c3c1482b41b35a32
merged
woot! I'm still working on some bugs in clone tags (ctrl+r doesnt work) but the core tags plugin should be completely functional.
ah ok sounds good
Adds tagging #249.
Very similar to marks, but non unique. Each tag has a tag root, which stores clones of all rows with that tag. Each tag root is marked for easy lookup.
'#' to create a tag. 'd#[number]' to delete a tag with index [number] (1 indexed) 'd#' to delete a tag if the row only has one tag
Cloning logic: The tag root is the node with mark = tag Rows are cloned when a tag is added to that row. Rows are uncloned when a tag is deleted from that row. If the tag root does not exist, one is generated at the document root and all tagged rows are cloned. I'm not sure if this logic is best.
Should probably add unit tests