diff --git a/crates/ui-egui/src/dialogs/hyphenation.rs b/crates/ui-egui/src/dialogs/hyphenation.rs index b1f3894c55..d6767ba3bc 100644 --- a/crates/ui-egui/src/dialogs/hyphenation.rs +++ b/crates/ui-egui/src/dialogs/hyphenation.rs @@ -227,15 +227,17 @@ mod tests { let modal = control(&tree, "Hyphenation", Role::Dialog, None); let count = control(&tree, "Words Longer Than:", Role::SpinButton, Some(modal)); let enabled = control(&tree, "Hyphenation", Role::CheckBox, Some(modal)); + let capitalized = control(&tree, "Hyphenate Capitalized Words", Role::CheckBox, Some(modal)); let footer = control(&tree, if apply { "OK" } else { "Cancel" }, Role::Button, Some(modal)); assert!(screen.expand(0.5).contains_rect(modal)); - for bounds in [count, enabled, footer] { + for bounds in [count, enabled, capitalized, footer] { assert!(bounds.is_positive() && modal.expand(0.5).contains_rect(bounds), "{lang}: {bounds:?} outside {modal:?}"); } let before = driver::fields(&app); assert_eq!(before.number("wordsLongerThan"), Some(5.0)); assert_eq!(before.bool("hyphenate"), Some(false)); assert!(before.is_mixed("afterFirst")); + assert_eq!(before.bool("hyphenateCapitalized"), Some(true)); // The counts take input once Hyphenation is on. click(&mut app, &mut frame, enabled.center()); settle(&mut app, &mut frame); @@ -251,6 +253,15 @@ mod tests { if checked != Some(true) || kept != (Some(8.0), Some(true)) || !driver::fields(&app).is_mixed("afterFirst") { failures.push(format!("{lang} {answer}: {checked:?}, {kept:?}")); } + // Clicking another option after typing keeps the typed count. + click(&mut app, &mut frame, capitalized.center()); + settle(&mut app, &mut frame); + let inspected = draft(&app, &ctx); + let other = (inspected["wordsLongerThan"].as_f64(), inspected["hyphenateCapitalized"].as_bool()); + eprintln!("{lang}, {answer}: ui.inspect after the second checkbox {other:?}"); + if other != (Some(8.0), Some(false)) { + failures.push(format!("{lang} {answer}: after the second checkbox {other:?}")); + } assert_eq!(paras(&app, id), original, "{lang}: only the draft changes while open"); if answer == "ui.dialog.confirm" { let (request, _) = ControlRequest::new(answer, json!({})); @@ -279,6 +290,7 @@ mod tests { for p in [&mut expected.0, &mut expected.1] { p.hyphenation.words_longer_than = 8; p.hyphenate = true; + p.hyphenation.capitalized = false; } if actual != expected || undo_delta != 1 { failures.push(format!( diff --git a/docs/mcp.md b/docs/mcp.md index f77b041d47..4c7991433e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -14179,10 +14179,10 @@ listed word. The options are saved with the paragraph (`hyphenation` in `para`) defaults, and paragraph styles carry them (`paraStyle.new {attrs: {hyphenation: {words_longer_than: 8}}}`). One undo step. `ui.hyphenation` opens the Hyphenation dialog on the values the Paragraph panel shows; OK sends the values that changed. The options below the Hyphenation checkbox take input only while it is checked, and Hyphenation Zone is -disabled while no paragraph in scope uses a single-line composer. The UI command `type.hyphenate` (Cmd+Alt+Shift+H, in remote mode `press_key {key: "H", mods: {cmd: true, -alt: true, shift: true}}` or `invoke_menu`) does what the Hyphenate checkbox does: it turns `hyphenate` off when -every paragraph of the selected type (or every paragraph the Type tool's selection touches) hyphenates, else on, and -returns the new value. +disabled while no paragraph in scope uses a single-line composer. The UI command `type.hyphenate` (Cmd+Alt+Shift+H, +in remote mode `press_key {key: "H", mods: {cmd: true, alt: true, shift: true}}` or `invoke_menu`) does what the +Hyphenate checkbox does: it turns `hyphenate` off when every paragraph of the selected type (or every paragraph the +Type tool's selection touches) hyphenates, else on, and returns the new value. ```json {"name":"run_command","arguments":{"command":"text.setFormat","params":{"hyphenate":true,"wordsLongerThan":8,"hyphenLimit":2}}}