Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differ: old changes should not "swallow" incoming change when it is handled #4332

Closed
scofalik opened this issue Apr 3, 2018 · 1 comment · Fixed by ckeditor/ckeditor5-engine#1393
Assignees
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@scofalik
Copy link
Contributor

scofalik commented Apr 3, 2018

At the moment, when model.Differ handles a new incoming change, it is "transformed" by old changes. Sometimes old change "swallow" a new change. This means that the new change becomes included in the old change. For example:

// ...
} else if ( inc.offset < old.offset ) {
	old.offset = inc.offset;
	old.howMany += inc.nodesToHandle;

	inc.nodesToHandle = 0;
}

inc is included into old. But... it is inc which is then transformed by other changes, not old. After old "swallows" inc, it stays as it is, but it has conflicts with other changes. Those conflicts are not processed and differ may crash.

Instead, inc should always "swallow" old.

@scofalik scofalik self-assigned this Apr 3, 2018
@scofalik
Copy link
Contributor Author

scofalik commented Apr 3, 2018

This would crash when there are multiple changes in one model.change chain, when there are multiple inserts and removes inside one parent and then there is one big remove including previous changes.

pjasiun referenced this issue in ckeditor/ckeditor5-engine Apr 4, 2018
Fix: `model.Differ` should not throw when multiple, intersecting remove changes were buffered. Closes #1392.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 15 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:engine labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants