_Rope: Add a leaf node reference to indices. Implement explicit index invalidation

This commit is contained in:
Karoy Lorentey committed 2023-03-20 13:12:09 -07:00
1 parent 8f48c3ae37
commit 3cc5a3888a
21 files changed
+671 -281

No files matched your search

@@ -36,7 +36,8 @@ extension _BString {
// full grapheme breaking state of the ingester at the start of the insertion.
// (We'll use it to resync grapheme breaks in the parts that follow the insertion.)
var (ingester, _, path) = ingester(forInserting: other, at: index, allowForwardPeek: false)
let r = rope[path.rope].insert(from: &ingester, at: path.chunk)
let i = path.chunk
let r = rope.update(at: &path.rope) { $0.insert(from: &ingester, at: i) }
switch r {
case let .inline(r):
assert(ingester.isAtEnd)