FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
Effects panel: keep the whole name of a folder that contains a slash
CokeRoach9203732393c2
diff --git a/crates/ui-egui/src/panels/effects.rs b/crates/ui-egui/src/panels/effects.rsindex df3e7d939..c4f5c15bb 100644--- a/crates/ui-egui/src/panels/effects.rs+++ b/crates/ui-egui/src/panels/effects.rs@@ -154,7 +154,9 @@ fn folder_row(app: &mut FilmcraftApp, ui: &mut egui::Ui, key: &str, depth: usizet.text_dim,);icons::paint(ui.painter(), Rect::from_center_size(pos2(x + 18.0, r.center().y), vec2(13.0, 13.0)), Icon::Folder, t.text_dim);- let name = key.rsplit('/').next().unwrap_or(key);+ // a sub-folder key is `<top>/<folder>`; folder names may themselves contain a slash+ // (Audio Effects ▸ Noise Reduction/Restoration), so split once, after the top folder+ let name = if depth == 0 { key } else { key.split_once('/').map_or(key, |(_, folder)| folder) };ui.painter().text(pos2(x + 30.0, r.center().y), Align2::LEFT_CENTER, crate::i18n::t(name), Tokens::ui(12.0), t.text);app.auto.add(&format!("effects.folder.{key}"), r, name);if resp.clicked() {diff --git a/crates/ui-egui/tests/scripted.rs b/crates/ui-egui/tests/scripted.rsindex b5f105c7f..61b2b8be4 100644--- a/crates/ui-egui/tests/scripted.rs+++ b/crates/ui-egui/tests/scripted.rs@@ -231,6 +231,11 @@ fn effects_panel_lists_the_premiere_transition_folders() {for id in ["additive_dissolve_legacy", "clock_wipe_legacy", "cross_dissolve_legacy", "push_legacy", "whip_legacy"] {assert!(items.iter().any(|i| i == &format!("effects.item.{id}")), "{id}: {items:?}");}+ // a folder whose own name has a slash keeps all of it (Noise Reduction/Restoration, not Restoration)+ d.ok("ui.set", json!({"effectsSearch": "denoise"}));+ d.frames(3);+ let noise = d.ok("ui.elements", json!({"prefix": "effects.folder.Audio Effects/Noise Reduction/Restoration"}));+ assert_eq!(noise[0]["label"], json!("Noise Reduction/Restoration"), "{noise}");// obsolete transitions stay out of the paneld.ok("ui.set", json!({"effectsSearch": "venetian"}));d.frames(3);