fix(editor): reading-mode layout + stale-reload defects (#71 follow-up)
Five root causes behind Alexander's calibration findings: - Wrap to column: both canvases had a fixed 640pt text container — clipped instead of wrapping when the editor column is narrower (library + mentor open). widthTracksTextView = true now; measure polish can return with calibration. - Tables: TextKit2 stacks NSTextTable rows vertically (each row its own content-width fragment — no grid). The reading canvas forces the TextKit1 bridge (replaceLayoutManager); probe-verified grid + column borders. Read-only canvas — nothing editing-grade lost. - Heading-tail: a chunk like "# Title" followed by body lines (single newline, legal markdown) dropped everything after line one. The heading now renders, then the remaining lines as a soft-joined paragraph. - Stale reload (data-loss vector): ProseTextView seeded from session.loadText (open-time snapshot) — after a reading⇄editing swap the recreated editor showed the pre-paste text, and a keystroke there flushed stale content over the user's real edits. Seeds from session.text (live) now. - Quote one-char-per-line: did not reproduce after the layout fixes; root cause was the broken layout state above. EditorSessionTests debounce flake (50ms margin under parallel load) passed on both re-runs — timing margin, not a regression. Full suite green (94 unit + UI smoke); lint clean.
This commit is contained in:
1 parent
36858bcf1d
commit
c410c99bf8
4 files changed
+34
-9
No files matched your search
@@ -64,8 +64,14 @@ struct ReadingSurface: NSViewRepresentable {
|
||||
tv.isVerticallyResizable = true
|
||||
tv.isHorizontallyResizable = false
|
||||
tv.autoresizingMask = [.width]
|
||||
tv.textContainer?.containerSize = NSSize(width: 640, height: CGFloat.greatestFiniteMagnitude)
|
||||
tv.textContainer?.widthTracksTextView = false
|
||||
// Tables (#69) lay out correctly under TextKit1 only — TK2 stacks
|
||||
// NSTextTable rows vertically (probed). The canvas is read-only, so
|
||||
// nothing editing-grade is lost by forcing the TK1 bridge.
|
||||
tv.textContainer?.replaceLayoutManager(NSLayoutManager())
|
||||
// Wrap to the editor column (#68/71 fix): the container tracks the
|
||||
// view width — a fixed 640pt measure clipped in narrower columns.
|
||||
tv.textContainer?.containerSize = NSSize(width: 0, height: CGFloat.greatestFiniteMagnitude)
|
||||
tv.textContainer?.widthTracksTextView = true
|
||||
tv.textContainer?.lineFragmentPadding = 12
|
||||
tv.textContainerInset = NSSize(width: 0, height: 20)
|
||||
let scroll = NSScrollView()
|
||||
|
||||
Reference in new issue
Block a user