mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 10:48:15 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b872d8672
commit
5ee97d6766
3 files changed
+21
-1
No files matched your search
@@ -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";
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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::<FindLabels>();
|
||||
let checks: Vec<String> =
|
||||
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.
|
||||
|
||||
Reference in new issue
Block a user