fix: cursor should be invalidated

This commit is contained in:
Zixuan Chen 2022-10-22 11:05:47 +08:00
parent 9407f52a1d
commit 65d6f4ffe9

View file

@ -96,14 +96,15 @@ impl<'a> Iterator for EffectIter<'a> {
id.counter, id.counter,
id.counter + cursor.len as Counter, id.counter + cursor.len as Counter,
); );
// SAFETY: cursor is valid here
let content = unsafe { cursor.get_sliced().slice };
let changed = self let changed = self
.tracker .tracker
.update_cursors(smallvec![cursor], StatusChange::SetAsCurrent); .update_cursors(smallvec![cursor], StatusChange::SetAsCurrent);
assert_eq!(changed as usize, span.len()); assert_eq!(changed as usize, span.len());
return Some(Effect::Ins { return Some(Effect::Ins {
pos: index, pos: index,
// SAFETY: cursor is valid content,
content: unsafe { cursor.get_sliced().slice },
}); });
} }
FirstCursorResult::Del(id, del) => { FirstCursorResult::Del(id, del) => {