diff --git a/crates/ui/src/docking/handle_names_tests.rs b/crates/ui/src/docking/handle_names_tests.rs index 04952fe6d..d7de97327 100644 --- a/crates/ui/src/docking/handle_names_tests.rs +++ b/crates/ui/src/docking/handle_names_tests.rs @@ -177,6 +177,9 @@ fn a_label_that_is_only_the_placeholder_falls_back_to_the_default() { assert_eq!(labels::named("{name}", labels::MOVE_GROUP, String::new), "Move tab group"); assert_eq!(labels::named("{name}", labels::MOVE_GROUP, || "Layers".into()), "Layers"); assert_eq!(labels::named("Move the {name} column", labels::MOVE_COLUMN, || " \t".into()), "Move the column"); + // A digit is enough to keep the label's own text. + assert_eq!(labels::named("{name} 2", labels::MOVE_GROUP, String::new), "2"); + assert_eq!(labels::named("({name})", labels::MOVE_GROUP, String::new), "Move tab group"); } #[test] diff --git a/crates/ui/src/docking/labels.rs b/crates/ui/src/docking/labels.rs index c86cb5109..6bed1f9cc 100644 --- a/crates/ui/src/docking/labels.rs +++ b/crates/ui/src/docking/labels.rs @@ -103,8 +103,8 @@ impl DockStyle { /// `label` with every `{name}` replaced by `name()`, which only runs when there is one. A blank /// name leaves each placeholder out with what only made sense around it (see [`unnamed`]); a -/// label with no letter left gives `fallback`, so no handle is announced with a hole in its name -/// or without one. +/// label with no letter or digit left gives `fallback`, so no handle is announced with a hole in +/// its name or without one. pub(super) fn named(label: &str, fallback: &str, name: impl FnOnce() -> String) -> String { if !label.contains(NAME) { return label.to_owned(); diff --git a/docs/ui-docking.md b/docs/ui-docking.md index 37939a699..08fa03415 100644 --- a/docs/ui-docking.md +++ b/docs/ui-docking.md @@ -747,8 +747,8 @@ what the handle moves: the logical label of the panel the group shows, or of the column's groups show, joined by ", " (fixed, not localized). An untitled panel is left out. With no title at all, the placeholder goes with the brackets or quotes around it, a separator right after it and one of the spaces beside it ("Move the tab group", "Move tab group ({name})" gives -"Move tab group", "移动{name}标签组" gives "移动标签组"); a label left with no letter falls back -to the English default. Two groups showing panels of the same title still get the same name. +"Move tab group", "移动{name}标签组" gives "移动标签组"); a label left with no letter or digit falls +back to the English default. Two groups showing panels of the same title still get the same name. ## Testing