mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 17:56:50 -06:00
Undo/Redo: the menu names the step with the History panel's own function
This commit is contained in:
@@ -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))]),
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user