a02d892f831f
history.rs
use super::{SoundApp, Tokens, Ui, json};
pub(crate) fn undo_history(app: &mut SoundApp, ui: &mut Ui) {
let hist = app.engine.undo_history();
let n = hist.len();
egui::ScrollArea::vertical().show(ui, |ui| {
for (i, h) in hist.iter().enumerate() {
if ui.selectable_label(i + 1 == n, format!("{} {}", i + 1, crate::localization::text(h))).clicked() {
for _ in 0..(n - i - 1) {
let _ = app.run("edit.undo", json!({}));
}
}
}
if let Some(r) = app.engine.redo_label() {
ui.label(
egui::RichText::new(crate::localized_format!("(redo) {r}", r = crate::localization::text(r)))
.italics()
.color(Tokens::current().text_dim),
);
}
});
}
No file is open. Choose one in the tree, or press Ctrl+O (⌘O on a Mac) to find one by name.
Syntax highlighting could not load. The unmodified read-only text remains available above.