feat(outline): mixed-content open guard — S7 (#111)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Opening a type: outline piece whose body parses with dropped prose (paragraph lines between bullets) now asks before the outliner mounts: Open in Prose (default, nothing drops), Open as Outline (explicit consent to save normalization), or Cancel. The detector shares the parser's item definition, the ask presents over an empty editor so nothing can normalize on save before the choice, and the prose answer rides a routing override that dies with the next open. Audit round pinned the lifecycle: reselect of the open piece is a no-op (an armed debounce must never flush mid-ask), and a draft or guest staged during the ask displaces it without being destroyed. Closes #111 [Generated by AI]
This commit is contained in:
1 parent
c23ee0f62f
commit
0b172f73ef
12 files changed
+440
-17
No files matched your search
@@ -254,4 +254,20 @@ struct OutlineTreeTests {
|
||||
#expect(rootResult == .newNode(path: [2], caret: 0))
|
||||
#expect(rooted.map(\.text) == ["a", "", ""])
|
||||
}
|
||||
|
||||
// #111 (S7): the mixed-content detector behind the open guard.
|
||||
|
||||
@Test func `parsesWithLoss flags prose between bullets and stays quiet otherwise`() {
|
||||
// The exact hazard: prose after the first item would drop on save.
|
||||
#expect(OutlineTree.parsesWithLoss("- one\nan stray paragraph\n- two"))
|
||||
// Deep prose counts anywhere after the first item.
|
||||
#expect(OutlineTree.parsesWithLoss("- a\n - b\n prose under b"))
|
||||
// Clean canonical outline — no loss.
|
||||
#expect(!OutlineTree.parsesWithLoss("- one\n- two\n - nested"))
|
||||
// Preamble is verbatim by design — never a loss.
|
||||
#expect(!OutlineTree.parsesWithLoss("# Title\n\n- one\n- two"))
|
||||
// Blank lines between items are formatting, not prose.
|
||||
#expect(!OutlineTree.parsesWithLoss("- one\n\n- two\n"))
|
||||
#expect(!OutlineTree.parsesWithLoss(""))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user