Undo/Redo: the menu names the step with the History panel's own function

This commit is contained in:
bflatastic
2026-10-18 01:27:14 +07:00
parent 35d70f5531
commit 015bab68a1
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1907,7 +1907,7 @@ pub fn display_label(app: &VectorcraftApp, id: &str, label: &str) -> String {
"edit.undo" | "edit.redo" => {
let last = app.session.active().and_then(|d| if id == "edit.undo" { d.history.undo.last() } else { d.history.redo.last() });
// The step's name as the History panel lists it.
let name = |label: &str| crate::panels::history::step_name(lang, label).unwrap_or_else(|| label.to_string());
let name = crate::panels::history::shown;
match last {
Some(h) if id == "edit.undo" => fmt(tl!("Undo {name}"), &[("name", &name(&h.label))]),
Some(h) => fmt(tl!("Redo {name}"), &[("name", &name(&h.label))]),
+3 -2
View File
@@ -24,8 +24,9 @@ pub fn step_name(lang: crate::i18n::Lang, label: &str) -> Option<String> {
has(lang, &dotted).then(|| tr(lang, &dotted).trim_end_matches('…').to_string())
}
/// A step's name as the panel lists it: in the UI language, else as recorded.
fn shown(label: &str) -> String {
/// A step's name as the panel lists it: in the UI language, else as recorded. Edit › Undo and Redo
/// name the step the same way.
pub(crate) fn shown(label: &str) -> String {
step_name(crate::i18n::current(), label).unwrap_or_else(|| label.to_string())
}