Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

M12: the XFA notice bar starts its first layout note as a sentence

Eric Kaden93544ef1bff7
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index ad7483465..1a412ff63 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -4494,8 +4494,12 @@ fn notices(
let mut text =
crate::i18n::fmt(tl!("Dynamic XFA form laid out from its template: {pages}, {fields}."), &[("pages", &pages), ("fields", &fields)]);
if !x.warnings.is_empty() {
+ // The notes are clauses ("a picture is left out"); the first starts a sentence here.
+ let notes = x.warnings.join("; ");
+ let mut chars = notes.chars();
text.push(' ');
- text.push_str(&x.warnings.join("; "));
+ text.extend(chars.next().into_iter().flat_map(char::to_uppercase));
+ text.push_str(chars.as_str());
text.push('.');
}
Some(("text-cursor-input", text, true))
diff --git a/crates/ui-egui/tests/ui_group/xfa.rs b/crates/ui-egui/tests/ui_group/xfa.rs
index 327b2368d..34bc52386 100644
--- a/crates/ui-egui/tests/ui_group/xfa.rs
+++ b/crates/ui-egui/tests/ui_group/xfa.rs
@@ -66,8 +66,8 @@ fn a_dynamic_xfa_form_is_laid_out_and_filled() {
fn a_dynamic_xfa_form_says_when_laying_it_out_took_its_usage_rights_off() {
let xdp = pdfcraft_xfa::fixtures::template(2);
let h = open(pdfcraft_xfa::fixtures::usage_rights_shell(&xdp, "", false));
- h.get_by_label_contains("laid out from its template: 2 pages, 11 fields");
- h.get_by_label_contains("usage rights were removed");
+ // The note starts its own sentence after the layout's.
+ h.get_by_label_contains("laid out from its template: 2 pages, 11 fields. The form's usage rights were removed");
}
#[test]