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:
hjozwiak committed 2026-11-03 10:34:55 -05:00
1 parent 8ce5e5cdad
commit 7eef6e8be6
30 files changed
+1484 -174

No files matched your search

+17
View File
@@ -42,10 +42,27 @@ func move_caret_object_line(ctx context.Context, reader DocumentCaretReader, doc
offset = indices[position].end - 1
}
initialPosition := position
// Structural navigation already announced its target's whole line,
// including embedded children such as a heading's link. A following
// Down must leave that subtree, not descend into it and repeat the
// announcement as a new line. The target's own first range still uses
// the same-current logic below, so a long structural paragraph keeps
// advancing line by line within its own text.
structuralEnd := -1
if place.origin == StructuralNavigation {
structuralEnd = doc.SubtreeEnd(current)
}
for attempts := 0; attempts < len(indices)+1; attempts++ {
if position < 0 || position >= len(indices) {
return DocumentCaretMove{Position: documentPosition(doc, *place)}, nil
}
if command == CaretNextLine && structuralEnd >= current &&
indices[position].index >= current && indices[position].index <= structuralEnd &&
!(position == initialPosition && indices[position].index == current) {
position++
offset = 0
continue
}
node := doc.Nodes[indices[position].index]
if named_link_label(node.Snapshot) != "" && (command == CaretLineStart || command == CaretLineEnd) {
offset = 0