Skip to content

Collapse single word separators at source wrap boundaries - #30

Merged
dangduc merged 6 commits into
dangduc:masterfrom
fastducduc:codex/collapse-wrapped-separators
Sep 11, 2026
Merged

Collapse single word separators at source wrap boundaries#30
dangduc merged 6 commits into
dangduc:masterfrom
fastducduc:codex/collapse-wrapped-separators

Conversation

@fastducduc

@fastducduc fastducduc commented Sep 11, 2026

Copy link
Copy Markdown

Single spaces between words no longer add a leading gap when source text wraps. An isolated ordinary space keeps native elasticity, so it can collapse at the previous line’s edge when there is insufficient room. The stored source remains unchanged.

Repeated spaces, trailing spaces, paragraph indentation, tabs, nonbreaking spaces, and spaces with attached combining characters retain their existing behavior. Native text-storage processing owns glyph invalidation; this adds no editing or caret-drawing override. Printable ASCII neighbors use a measured fast path; all other eligible separators retain the full composed-character check. This refines #28.

Source editor with wrapped separators

Validation on macOS 26.5.2 (25F84), Xcode 26.6 (17F113):

  • Corrected Intel Development build passed, targeting macOS 10.13.
  • Focused separator checks passed 10,316 assertions per architecture on arm64 and x86_64 through Rosetta. Both negative controls rejected the former wrap behavior.
  • The copied-app separator suite passed 32 checks. Existing wrapping suites passed 74,736 assertions per architecture and 1,305 copied-app checks.
  • Both required desktop suites ran again. Multiwindow reproduced its documented library-replacement failure (exit 245). The aggregate passed the wrapping and separator checks, then stopped at the recorded Fuzzy UI activation failure. Later entries did not run; the complete suites did not pass.

All three rounds of six code-writing reviews are complete. The round-two P3 performance finding was corrected before round three. The actual correction reduced a 256K-paragraph start-edit pair from 132.004 to 118.855 ms in the review benchmark, with matching source, glyph properties, and geometry. This measures layout, not full-app typing latency. No actionable review finding remains unaddressed.

Review comments: round one, round two, correction, and round three. The named lenses are engineering perspectives, not reviews by those people.

See the validation record and review index for reproducible evidence and tested app hashes. The screenshot uses native bitmap drawing and omits window-server composition and shadow. macOS 13.7.8, physical input methods, and compositor caret pixels remain manual validation limits.

@fastducduc

Copy link
Copy Markdown
Author

Round 1 reviewed production commit 9e6c8dd6adc058e7044f2c562532af97dd4e63d4 against 75d6f42. The later d5232b4 commit adds tests and documentation only.

These are six subagent engineering perspectives, not reviews by the named people. Each reviewer wrote and ran new code. No actionable finding required a production correction in this round.

  • John Ousterhout: 36 cached-versus-fresh production layout comparisons per architecture passed. Shared storage, separate layouts, attributed edits, combining characters, note detachment, and empty-note reuse preserved ownership and source data.
  • Dan Luu: 44,158 checks passed in an Intel layout benchmark. Short-note initial layout added 0.014–0.017 ms. For 32,830 UTF-16 units, initial layout changed from 7.056 to 8.202 ms; an insertion/deletion pair changed from 7.093 to 8.210 ms. Initial explicit property-buffer allocations fell from 32 to zero. This measures layout cost, not application input latency.
  • Linus Torvalds: 16,419 assertions per architecture passed. Evidence covers 1,936 callback cases, 16 allocation failures, native font fallback, buffer ownership, glyph indexes, and preservation of unrelated property bits.
  • Kyle Kingsbury: 182 copied-app checks and 33 fresh-layout comparisons passed. Paragraph joins/splits, peer selections, Undo/Redo, copy, and save/reopen preserved the expected source and geometry.
  • Contrarian UX: 1,642 assertions per architecture passed. Six collapsed-separator fixtures matched native word wrapping for movement, selection, caret affinity, and click targets. Marked-text API replacements preserved source and fresh-layout equality.
  • Contrarian platform compatibility: 1,406 assertions and 18 paragraph/font/attachment comparisons per architecture passed. Strict API availability checks and Mach-O metadata confirmed the Intel 10.13 and arm64 11.0 deployment targets. Attachment-layout differences also occurred in the baseline and do not establish a regression in the plain-text editor.

The evidence runs on macOS 26.5.2 with Xcode 26.6. Intel code ran through Rosetta. It does not establish macOS 13.7.8 behavior, physical IME input, or compositor caret pixels.

Reports, probe code, results, and further limits: Round 1 evidence.

@fastducduc

Copy link
Copy Markdown
Author

Round 2 reviewed 2ea92180939a3e51df8fe867ad548140ed455868. Production was unchanged from round one. All six reviewers wrote and ran new probes.

P3 performance finding: Separators with strictly printable ASCII neighbors need not query their composed-character range. A 256K-paragraph start-edit pair took 113.411 ms in the base and 131.697 ms in the candidate. Both generated the same glyphs. A separate instrumented experiment saved 9.432 ms with an ASCII shortcut and passed 14 mixed/composed controls. This is layout evidence, not full-app typing latency. The correction will retain the complete composed-character check for every non-ASCII neighbor and will be validated before round three.

  • John Ousterhout: 2,670 assertions and 162 fresh-layout comparisons per architecture passed across all six request orders for three shared layouts. Targeted invalidation, note exchange, metric changes, and paragraph-cache release remained local to each layout.
  • Dan Luu: Identified the P3 recommendation above. Long paragraphs already require broad regeneration for edits near the start; the new code did not amplify that work. Short-paragraph edits remained local. The report separates baseline timing from the shortcut experiment.
  • Linus Torvalds: 6,703 assertions per architecture passed across 86 Unicode-neighbor cases and 258 edit phases. Cached glyphs matched fresh production; mappings, bidi levels, attributes, and source were preserved.
  • Kyle Kingsbury: 117 actual-app assertions passed across 36 seeded edit/Undo/Redo commands and 74 fresh-layout comparisons in two shared editors.
  • Contrarian UX: 164 assertions per architecture passed for deletion, replacement, native caret affinity, and trailing-space-to-separator transitions.
  • Contrarian platform compatibility: 252 assertions per architecture passed across ten metric/hard-break cases. CRLF, CR, LF, U+2028, U+2029, and their indentation remained intact.

No other actionable findings arose. The named lenses are subagent engineering perspectives, not reviews by those people. Runtime coverage remains macOS 26.5.2; older macOS, physical input methods, and final compositor pixels remain outside these probes.

Round 2 reports, executable probes, results, and limits.

@fastducduc

Copy link
Copy Markdown
Author

Addressed the round-two P3 finding in e022109. The callback reads both neighbors once and skips the composed-character query only for U+0021–U+007E on both sides. Unicode neighbors retain the full guard. The implementation was delegated to a subagent and then inspected.

The corrected Development build passed. Focused checks passed 10,316 assertions per architecture; both negative controls rejected the old behavior. The actual-app separator suite passed 32 checks. Existing wrapping checks passed 74,736 assertions per architecture and 1,305 actual-app checks.

Both required desktop suites ran again: multiwindow reproduced its documented library-replacement failure (exit 245), and the aggregate stopped at the recorded Fuzzy UI activation failure. Later entries did not run. Corrected app SHA-256: b28da33e5f645a589f4802d778225693f7e0764abf6a48a21690d154421ad40c.

Round three will review this corrected production commit with new code and evidence.

@fastducduc

Copy link
Copy Markdown
Author

Round 3 reviewed corrected production commit e022109eaf2bad6583512c2ed2b48561d9dae011. All six code-writing reviews are complete. The round-two P3 finding is resolved, with no new actionable findings.

  • John Ousterhout: 2,104 assertions per architecture passed, including 28 shared-layout comparisons and 376 callback-budget checks. ASCII contexts made no composed-range queries; Unicode transitions restored the fallback immediately. This reviewer implemented the correction and identifies this round as a self-review. The other five perspectives reviewed it independently.
  • Dan Luu: The actual committed code eliminated ASCII composed-range queries. A 256K start-edit pair improved from 132.004 to 118.855 ms. Unicode fallback remained active, with overlapping timing ranges. Source, glyph properties, positions, and line rectangles matched before and after the correction. These are layout measurements, not full-app typing latency.
  • Linus Torvalds: 171,497 assertions per architecture passed. All 8,836 printable-ASCII neighbor pairs satisfied Foundation's singleton-space oracle in seven contexts. All 36,525 native glyphs matched the pre-fix implementation; Unicode fallback remained intact.
  • Kyle Kingsbury: 150 actual-app assertions passed across ten Unicode transitions with Undo/Redo, 70 fresh-layout comparisons, and two note-switch cycles. The tested app hash matches the rebuilt correction.
  • Contrarian UX: 1,200 checks passed across both architectures and both pre/post optimization hooks. Width and marked-text histories preserved source, selection, affinity, and insertion positions. An initial bare-space-width assumption failed for an accented space; that geometry also matches the original fixed-width policy and does not establish a regression.
  • Contrarian platform compatibility: 148 assertions and 12 exact layout comparisons per architecture passed across split fonts, kerning, ligatures, baseline offsets, and ASCII/Unicode neighbors. Strict API availability and deployment metadata checks passed.

This completes all 18 reviews. The named lenses are engineering perspectives, not reviews by those people. Round 3 reports, probes, results, and limits.

The corrected Development build and focused checks passed. CI passed for the corrected production commit. Both required desktop suites reproduced their documented failures: library replacement in the multiwindow runner and Fuzzy UI activation in the aggregate runner. Later aggregate entries did not run. macOS 13.7.8 and physical input/compositor behavior remain manual validation limits.

@dangduc
dangduc merged commit 0f65128 into dangduc:master Sep 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants