operational-transform-rs icon indicating copy to clipboard operation
operational-transform-rs copied to clipboard

Why retain(n) only works if n equal to the length of the string?

Open drriguz opened this issue 1 year ago • 0 comments

Hi,

I'm trying to understand how this library works, I found it a little bit confusing:

let mut a = OpSeq::default();
a.retain(1);   
a.insert("def");
let t = a.apply("abc").unwrap();  // only works if retain(3), otherwise t will be None

Accroding to my understanding, retain(n) should only fail if n is negative, or larger then the last position of the string, in the above code, should we get "adefbc" instead?

drriguz avatar Jul 02 '24 07:07 drriguz