From d6ddf749fecbe04e325da8ddd7721a133c385169 Mon Sep 17 00:00:00 2001 From: moppeeer Date: Mon, 12 Oct 2026 00:24:48 +0200 Subject: [PATCH] fix(compose): Words in capitals hyphenate like capitalized words A word typed in capitals was never hyphenated, so a heading such as FERRUM COMMODI UNTI moved the whole word to the next line where InDesign breaks it (COM-MODI). Capital words now follow Hyphenate Capitalized Words like words with a capital first letter: on by default, and turning it off keeps both, acronyms included, whole. Co-Authored-By: Claude Opus 5.5 --- ROADMAP.md | 1 + crates/compose/src/hyphen/mod.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 9a0f71e70..031e04489 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -129,6 +129,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m Newest first. +- **2026-10-12** · Words in capitals hyphenate like capitalized words (FERRUM COM-MODI), as in InDesign; Hyphenate Capitalized Words off keeps them whole. No readiness percentage change. - **2026-10-10 (UI.4–UI.5):** Panel tabs can move into other groups, split the dock, float, resize and return to their saved locations through shared docking transactions. Layouts persist in custom workspaces; UI and control commands share the same validated action path. Shared pane geometry and widget-state theme application retain all five palettes and local fonts. Split panes send keyboard input only to the focused canvas and scope contextual toolbar IDs per pane. No readiness percentage change. - **2026-10-10** · Version 0.6.0; releases add a Linux riscv64 tar.gz (cross-compiled, CLI smoke-tested under QEMU). diff --git a/crates/compose/src/hyphen/mod.rs b/crates/compose/src/hyphen/mod.rs index 22644eb70..a4c7657de 100644 --- a/crates/compose/src/hyphen/mod.rs +++ b/crates/compose/src/hyphen/mod.rs @@ -232,9 +232,8 @@ pub fn hyphen_points_in(word: &str, lim: &Limits, lang: Lang) -> Vec { if letters < lim.min_word.max(2) { return false; } - if letters > 1 && run.iter().filter(|c| c.is_alphabetic()).all(|c| c.is_uppercase()) { - return false; - } + // Words in capitals (FERRUM COMMODI) hyphenate like capitalized words, as InDesign's: Hyphenate + // Capitalized Words off keeps both, acronyms included, whole. if !lim.capitalized && run[0].is_uppercase() { return false; } @@ -332,7 +331,10 @@ mod tests { #[test] fn case_apostrophes_and_punctuation() { assert_eq!(h("Typography"), "Ty-pog-ra-phy"); - assert_eq!(h("TYPOGRAPHY"), "TYPOGRAPHY"); + assert_eq!(h("TYPOGRAPHY"), "TY-POG-RA-PHY"); + assert_eq!(h("COMMODI"), "COM-MO-DI"); + let whole = Limits { capitalized: false, ..Limits::default() }; + assert_eq!(hyphenate_word("TYPOGRAPHY", &whole), "TYPOGRAPHY", "Hyphenate Capitalized Words off"); assert_eq!(h("typography,"), "ty-pog-ra-phy,"); assert_eq!(h("“typography”"), "“ty-pog-ra-phy”"); assert_eq!(h("typography's"), "ty-pog-ra-phy's");