Make web document navigation survive live-updating pages
Recreated-node caret recovery, tolerant caret validation, per-root retained document trees and cursors across tab switches, document warm-up, coalesced structural moves, and hung-provider fast-fail with an 'Application is not responding' announcement.
This commit is contained in:
1 parent
8ce5e5cdad
commit
7eef6e8be6
30 files changed
+1484
-174
No files matched your search
@@ -540,13 +540,8 @@ func (adapter *Adapter) invalidateReplacedDocument(sourceID, activeID ObjectID)
|
||||
if !sourceID.Valid() || sourceID != activeID {
|
||||
return
|
||||
}
|
||||
adapter.treeMutex.Lock()
|
||||
trees := []*AccessibleTree{adapter.tree, adapter.documentTree, adapter.documentTextTree}
|
||||
adapter.treeMutex.Unlock()
|
||||
trees := adapter.ownedTrees()
|
||||
for _, tree := range trees {
|
||||
if tree == nil {
|
||||
continue
|
||||
}
|
||||
root, err := tree.Root()
|
||||
if err != nil || root.ID().BusName != sourceID.BusName {
|
||||
continue
|
||||
@@ -574,10 +569,23 @@ func (adapter *Adapter) invalidateTreeEventWithPolicy(eventType string, detail1
|
||||
}
|
||||
}
|
||||
}
|
||||
// Kinds parallel the historical slot indices: 0 review, 1 semantic
|
||||
// document, 2 document text. Stashed documents repeat kinds 1 and 2.
|
||||
adapter.treeMutex.Lock()
|
||||
trees := []*AccessibleTree{adapter.tree, adapter.documentTree, adapter.documentTextTree}
|
||||
kinds := []int{0, 1, 2}
|
||||
for _, id := range adapter.stashedDocumentIDs {
|
||||
stashed := adapter.stashedDocuments[id]
|
||||
if stashed.tree != nil {
|
||||
trees, kinds = append(trees, stashed.tree), append(kinds, 1)
|
||||
}
|
||||
if stashed.textTree != nil {
|
||||
trees, kinds = append(trees, stashed.textTree), append(kinds, 2)
|
||||
}
|
||||
}
|
||||
adapter.treeMutex.Unlock()
|
||||
for index, tree := range trees {
|
||||
for position, tree := range trees {
|
||||
index := kinds[position]
|
||||
if navigationDefunct && index == 1 && tree != nil {
|
||||
tree.mu.RLock()
|
||||
entry := tree.nodes[sourceID]
|
||||
|
||||
Reference in new issue
Block a user