You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Peritext algorithm may attach a non-exist ghost mark to a newly inserted string. It is also reproducible in Automerge's implementation. But it can be fixed without affecting the validity of the historical data.
Steps to reproduce the issue in this repo
This can be replicated by adding this micromerge test
The problem is caused by this fix in the paper. In this example, when Peritext inserts the new char '!', it prefers the positions after the tombstone with the end of the link. And the tombstone is after the beginning of the bold mark. So '!' turns out to be bold.
In my implementation, I've fixed this by adding a new rule for choosing the insertion position among tombstones:
Insertions occur before tombstones that contain the beginning of new marks. (new)
Insertions occur before tombstones that contain the end of bold-like marks
Insertions occur after tombstones that contain the end of link-like marks
Rule 1 should be satisfied before rules 2 and 3 to avoid this problem.
This solution can clearly fix the example given above and make it satisfy all of the rules. The only downside is it might make a "link-like mark" grow forward unexpectedly a bit more often. But it seems to be more tolerable.
The text was updated successfully, but these errors were encountered:
zxch3n
changed the title
Peritext algorithm may attach deleted mark to the new inserted text
Peritext algorithm may attach deleted mark to new inserted text
May 17, 2023
The Peritext algorithm may attach a non-exist ghost mark to a newly inserted string. It is also reproducible in Automerge's implementation. But it can be fixed without affecting the validity of the historical data.
Steps to reproduce the issue in this repo
This can be replicated by adding this micromerge test
Why
The problem is caused by this fix in the paper. In this example, when Peritext inserts the new char '!', it prefers the positions after the tombstone with the end of the link. And the tombstone is after the beginning of the bold mark. So '!' turns out to be bold.
In my implementation, I've fixed this by adding a new rule for choosing the insertion position among tombstones:
Rule 1 should be satisfied before rules 2 and 3 to avoid this problem.
This solution can clearly fix the example given above and make it satisfy all of the rules. The only downside is it might make a "link-like mark" grow forward unexpectedly a bit more often. But it seems to be more tolerable.
The text was updated successfully, but these errors were encountered: