Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

don't drop-cap-glue a wrapped "I"/"A" in the manuscript Format pass

[._.]/ Adam Eivy76b32a07b02e
diff --git a/client/src/lib/manuscriptFormat.js b/client/src/lib/manuscriptFormat.js
index d34cbc65f1..bee4e8398e 100644
--- a/client/src/lib/manuscriptFormat.js
+++ b/client/src/lib/manuscriptFormat.js
@@ -50,8 +50,12 @@ const dehyphenate = (text) => text.replace(/([A-Za-z])-\n([a-z])/g, '$1$2');
// Re-attach a stylized drop-cap that landed on its own line: a line that is a
// single uppercase letter immediately followed by a line starting lowercase.
-// "T\nhe dawn" → "The dawn". Lookahead keeps the next line's first char.
-const rejoinDropCaps = (text) => text.replace(/^([A-Z])\n(?=[a-z])/gm, '$1');
+// "T\nhe dawn" → "The dawn" (joined with NO space — it's one word). `I` and `A`
+// are excluded: they're the only single-letter English words, so a lone `I`/`A`
+// is almost always the WORD wrapped to its own line ("I\nam …"), which must
+// join WITH a space — left to reflowProse — not glue into "Iam". The rare
+// drop-cap "In"/"And" is the accepted miss.
+const rejoinDropCaps = (text) => text.replace(/^([B-HJ-Z])\n(?=[a-z])/gm, '$1');
// Re-attach closing double-quotes the PDF export orphaned. Three artifacts, all
// keyed on a `"` separated from the text it should hug. (Straight quotes only —
diff --git a/client/src/lib/manuscriptFormat.test.js b/client/src/lib/manuscriptFormat.test.js
index bc88af323c..638496e346 100644
--- a/client/src/lib/manuscriptFormat.test.js
+++ b/client/src/lib/manuscriptFormat.test.js
@@ -7,6 +7,21 @@ describe('formatManuscript — prose reflow', () => {
expect(out).toBe('The dawn cycle hums to life.');
});
+ it('joins a wrapped "I" with a space, not as a drop-cap glue', () => {
+ // "I" is a word, not a stylized drop-cap — must become "I am", never "Iam".
+ expect(formatManuscript('I\nam absolutely, definitely here.', 'prose')).toBe(
+ 'I am absolutely, definitely here.',
+ );
+ });
+
+ it('joins a wrapped "A" with a space too', () => {
+ expect(formatManuscript('A\nman walked in.', 'prose')).toBe('A man walked in.');
+ });
+
+ it('still glues a genuine drop-cap (not I/A) with no space', () => {
+ expect(formatManuscript('T\nhe dawn cycle hums.', 'prose')).toBe('The dawn cycle hums.');
+ });
+
it('de-hyphenates a word split across a wrap', () => {
const out = formatManuscript('something approxi-\nmating daylight.', 'prose');
expect(out).toBe('something approximating daylight.');