Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/ui-egui/src/publicationwizard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ pub enum Step {

impl Step {
/// Where [`Draft`] keeps what each of the two steps with text fields has of its own: the
/// texts step's at 0, the sources step's at 1.
/// texts step's at 0, the sources step's at 1. A figure's reference step has none: it reads as
/// 0, so [`limit_note`] leaves the refusal out there.
fn slot(self) -> usize {
Comment thread
jgregoriorincon marked this conversation as resolved.
Resolved
usize::from(self == Step::Sources)
}
Expand Down Expand Up @@ -322,7 +323,7 @@ fn statistic_menu(ui: &mut egui::Ui, d: &mut Draft, map: &Map, own: Field) {
/// done unseen.
fn limit_note(ui: &mut egui::Ui, d: &mut Draft, fields: &[Field]) {
let limit = [("limit", &*MAX_PUBLICATION_TEXT.to_string())];
// A figure's step adds no statistic: a refusal on the sheet's sources step isn't its own.
// A figure's step adds no statistic, so no step's refusal is its own.
let note = if d.step != Step::Reference && d.refused[d.step.slot()] {
i18n::fmt("The statistic wasn't added: each field takes at most {limit} characters.", &limit)
} else if fields.iter().any(|&f| !d.off(f) && d.field_mut(f).chars().count() >= MAX_PUBLICATION_TEXT) {
Expand Down
6 changes: 3 additions & 3 deletions crates/ui-egui/src/publicationwizard/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@ mod tests {
assert!(h.get_by_role_and_label(Role::MultilineTextInput, "Reference").accesskit_node().is_disabled());
}

/// The figure's step says the command's limits, and not a statistic refused on the sheet's
/// sources step.
/// The figure's step says the command's limits, and not a statistic refused on a sheet's
/// step.
#[test]
fn a_figures_step_says_its_limits_only() {
let mut h = at(Step::Reference, |d| {
d.size = "figure-1col".into();
d.refused = [false, true];
d.refused = [true, true];
});
assert!(h.query_by_label(&refusal()).is_none());
assert!(h.query_by_label("At most 50 lines.").is_none());
Expand Down
Loading