Fix out of bounds cursors in case of trailing delete

This commit is contained in:
Andras Schmelczer 2025-04-13 22:21:38 +01:00
parent 78525cef45
commit 7c081e8939
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -309,7 +309,13 @@ where
let last_index = merged_operations
.iter()
.last()
.filter(|operation| {
matches!(
operation.operation,
Operation::Insert { .. } | Operation::Equal { .. }
)
})
.next_back()
.map_or(0, |op| op.operation.end_index());
for cursor in left_cursors.chain(right_cursors) {