-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
textDiff option set to "0" should allow single letters to be merged instead of taking the default value 60. #104
Comments
I see, you can't set that minimum to 0 without the default getting applied, although I'm curious in which scenario would you like to get text diffs generated for 1 char strings? that would be just way more inefficient (both in CPU cost and in the delta size) than normal diff by value, without bringing any advantage. |
haha oh well, the case is below. Thanks for this great library! The CPU cost and delta size is something we worry about at a higher level. For this library we need it to be able to handle the following case: The key is that this Say we start with an empty string: Within a short 200ms, Adam adds three letters "thi", and this arrived at the server. ther server replaces the then Bob also made some change and types You can test this out here: The power in Fraser's code is the weighted fuzzy patch, and it works surprisingly well. For short strings, it completely negates the need for operational transform. I'm not sure about long strings yet. |
Is there a way to fully disable this mode all together? Entering a very large number works, but isn't ideal. I'll open a new issue if requested. Values of zero, null, or -1 do not disable this mode. |
If you set
textDiff: {minLength: 0}
, the text diff falls back to the defaultminLength
of 60 characters. This prevents two single letter commits to merge properly.Setting
minLength
to1
allows two strings with at least 2 characters to properly diff merge. However for changes such as:"" => "a"
and"" => "b"
the merge simply takes the later one. If any further updates on a is made, it is also replaced by b.The text was updated successfully, but these errors were encountered: