Initial implementation of cursors (perf branch version)#307
Closed
ept wants to merge 6 commits intoperformancefrom
Closed
Initial implementation of cursors (perf branch version)#307ept wants to merge 6 commits intoperformancefrom
ept wants to merge 6 commits intoperformancefrom
Conversation
Member
Author
|
I think we have come to the conclusion that the approach to cursors in #313 is preferable to this one, since it keeps open the option of having frontend and backend on separate threads. I will therefore close this PR. |
echarles
pushed a commit
to datalayer-externals/automerge-classic-arch
that referenced
this pull request
Feb 16, 2023
Stop exposing apply_change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is the same as #306, but based on the performance branch rather than main. It provides a first attempt at an API for cursors.
A cursor is an object of the form
{objectId: 'string', elemId: 'string'}and it can be stored anywhere: inside an Automerge document or somewhere external. To get the cursor for a particular index of a text object, use:The cursor identifies a particular character in the text; the position of that character may change as text is inserted or deleted before it. To get the current index of a previously created cursor, use:
The third argument controls what to do if the character referenced by the cursor has been deleted. If
falseand the character has been deleted,getCursorIndexreturns -1. If the argument istrueand the character has been deleted,getCursorIndexreturns the index of the closest preceding non-deleted character, or -1 if there is no such preceding character.I am not super happy with this approach, but putting up the PR nevertheless so that folks can play with it.