Posted by ernestd on August 14, 2006 at 11:30am
There are two possible cases of collision:
Let's take the follosing parameters:
insert_A: where the user A inserts content
length_A: the content length inserted by user A
insert_B: where the user B inserts content
length_B: the content length inserted by user B
Important: this is only processed in case of replacement or deletion. Not in normal inserts
if (insert_B <= insert_A) {
// This is true if caret of user A is in between replacements or deletions done by user B
if ((insert_B + length_B) > insert_A) {
}
// the other way around
// This is true if caret of user B is between replacements or deletetions done by user A
elseif ((insert_A + length_A) > insert_B) {Add any other case that cross your mind :)