From 5ee97d6766119aeb2d80deef47ee6c8fcb518757 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 29 Nov 2026 23:06:09 +0000 Subject: [PATCH] Find and Replace: the simple dialog's word check box reads Find whole words only PowerPoint's dialog (word(false)) now says what the type's doc already promised, through a new word find.findWholeWordsOnly; Word's Search Options keep Whole words. Co-Authored-By: Claude Opus 5.5 --- crates/text/src/ui/find.rs | 1 + crates/text/src/ui/find/dialog.rs | 2 +- crates/text/tests/it/find_dialog.rs | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/text/src/ui/find.rs b/crates/text/src/ui/find.rs index 650d4eeea1..3e56d35c87 100644 --- a/crates/text/src/ui/find.rs +++ b/crates/text/src/ui/find.rs @@ -35,6 +35,7 @@ craft_ui::words! { replace_with: "find.replaceWith" = "Replace with:"; match_case: "find.matchCase" = "Match case"; whole_words: "find.wholeWords" = "Whole words"; + find_whole_words_only: "find.findWholeWordsOnly" = "Find whole words only"; use_wildcards: "find.useWildcards" = "Use wildcards"; search_options: "find.searchOptions" = "Search Options"; match_prefix: "find.matchPrefix" = "Match prefix"; diff --git a/crates/text/src/ui/find/dialog.rs b/crates/text/src/ui/find/dialog.rs index 2cde2d8384..600368f5ab 100644 --- a/crates/text/src/ui/find/dialog.rs +++ b/crates/text/src/ui/find/dialog.rs @@ -663,7 +663,7 @@ impl StackDialog for FindReplaceDialog { 'options: { if !word { check(ui, &words.match_case.clone(), &mut options.match_case, true); - check(ui, &words.whole_words.clone(), &mut options.whole_word, true); + check(ui, &words.find_whole_words_only.clone(), &mut options.whole_word, true); break 'options; } if clicked(&Button::new(words.search_options.clone()).show(ui)) { diff --git a/crates/text/tests/it/find_dialog.rs b/crates/text/tests/it/find_dialog.rs index 5336d4a5de..c16b2b1f6e 100644 --- a/crates/text/tests/it/find_dialog.rs +++ b/crates/text/tests/it/find_dialog.rs @@ -68,6 +68,25 @@ fn find_fields_set_by_automation_reach_the_next_request() { assert_eq!(fields["backwards"], json!(true)); } +/// PowerPoint's simpler dialog (`word(false)`) names its word check box "Find whole words only", where Word's Search +/// Options say "Whole words". +#[trial] +fn the_simple_dialogs_whole_word_check_reads_find_whole_words_only() { + use craft_text::ui::find::FindLabels; + use craft_ui::runtime::env::Env; + let dialog = Rc::new(RefCell::new(FindReplaceDialog::new("", FindTab::Find).word(false))); + let shown = dialog.clone(); + let mut fixture = Fixture::new(move |ui| { + let _ = shown.borrow_mut().show(ui, &DialogStack::default()); + }); + fixture.settle(); + let words = Env::of_root(fixture.ctx()).words::(); + let checks: Vec = + fixture.by_role(Role::CHECK_BOX).into_iter().filter_map(|check| fixture.tree().name_of(check.node).map(str::to_owned)).collect(); + assert!(checks.iter().any(|name| name == words.find_whole_words_only.as_str()), "the check boxes are {checks:?}"); + assert!(!checks.iter().any(|name| name == words.whole_words.as_str()), "Word's wording is not used: {checks:?}"); +} + // Escape in Find what closes the dialog and puts the focus back on the control that opened it, also where Escape // otherwise takes a field's focus (`escape_leaves_fields`). Typing in the field is reverted by the first Escape, which // keeps the focus in the field, and the next Escape closes the dialog.