You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-4Lines changed: 29 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# TextDiff
2
2
3
-
TextDiff is a macOS Swift package that computes token-level diffs and renders a merged, display-only SwiftUI view backed by a custom AppKit renderer.
3
+
TextDiff is a macOS Swift package that computes token-level diffs and renders a merged, display-only diff view for both SwiftUI (`TextDiffView`) and AppKit (`NSTextDiffView`) via the same custom AppKit renderer.
- No synthetic spacer characters are inserted into the rendered text stream.
102
126
- Chip top/bottom clipping is prevented internally via explicit line-height and vertical content insets.
103
127
- Moved text is not detected as a move; it appears as delete + insert.
104
-
- Rendering uses a custom AppKit draw view bridged into SwiftUI.
128
+
- Rendering uses a custom AppKit draw view shared by both `TextDiffView` and `NSTextDiffView`.
105
129
106
130
## Snapshot Testing
107
131
108
132
Snapshot coverage uses [Point-Free SnapshotTesting](https://github.com/pointfreeco/swift-snapshot-testing) with `swift-testing`.
109
133
110
134
- Snapshot tests live in `Tests/TextDiffTests/TextDiffSnapshotTests.swift`.
111
-
- Baselines are stored under `Tests/TextDiffTests/__Snapshots__/TextDiffSnapshotTests/`.
135
+
- AppKit snapshot tests live in `Tests/TextDiffTests/NSTextDiffSnapshotTests.swift`.
136
+
- Baselines are stored under `Tests/TextDiffTests/__Snapshots__/TextDiffSnapshotTests/` and `Tests/TextDiffTests/__Snapshots__/NSTextDiffSnapshotTests/`.
112
137
- The suite uses `@Suite(.snapshots(record: .missing))` to record only missing baselines.
113
138
114
139
Run all tests:
@@ -119,7 +144,7 @@ swift test 2>&1 | xcsift --quiet
119
144
120
145
Update baselines intentionally:
121
146
122
-
1. Temporarily switch the suite trait in `Tests/TextDiffTests/TextDiffSnapshotTests.swift` from `.missing` to `.all`.
147
+
1. Temporarily switch the suite trait in snapshot suites (for example, `Tests/TextDiffTests/TextDiffSnapshotTests.swift` and `Tests/TextDiffTests/NSTextDiffSnapshotTests.swift`) from `.missing` to `.all`.
123
148
2. Run `swift test 2>&1 | xcsift --quiet` once to rewrite baselines.
124
149
3. Switch the suite trait back to `.missing`.
125
150
4. Review snapshot image diffs in your PR before merging.
0 commit comments