From 7546ab992b9b33ef22cedd64be706c29e545ea2c Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 3 Nov 2026 09:56:05 -0500 Subject: [PATCH] Cap the folder indent at eight levels and test against the track's own folder Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/tracks.rs | 3 ++- crates/ui-egui/tests/it/track_list.rs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/tracks.rs b/crates/ui-egui/src/panels/tracks.rs index 2c746b1c..1be81dd0 100644 --- a/crates/ui-egui/src/panels/tracks.rs +++ b/crates/ui-egui/src/panels/tracks.rs @@ -89,7 +89,8 @@ pub fn tracks_and_groups(app: &mut SoundApp, ui: &mut Ui) { } ui.painter().rect_filled(Rect::from_min_size(pos2(r.min.x + 20.0, r.min.y + 3.0), vec2(4.0, 11.0)), 0.0, rgb(color)); ui.painter().with_clip_rect(r).text( - pos2(r.min.x + 30.0 + depth as f32 * 10.0, r.center().y), + // Indent stops growing at eight levels so a deep name keeps room in the column. + pos2(r.min.x + 30.0 + depth.min(8) as f32 * 10.0, r.center().y), Align2::LEFT_CENTER, &name, regular(11.5), diff --git a/crates/ui-egui/tests/it/track_list.rs b/crates/ui-egui/tests/it/track_list.rs index c2579962..b0407b29 100644 --- a/crates/ui-egui/tests/it/track_list.rs +++ b/crates/ui-egui/tests/it/track_list.rs @@ -127,6 +127,8 @@ fn deeply_nested_tracks_keep_indenting_past_six_folders() { } r.frame(vec![]); - let parent_name = r.app.engine.session().track(parent).unwrap().name.clone(); - assert!(r.text_x(&child_name) > r.text_x(&parent_name), "deeply nested child is not indented under its parent"); + // "Folder 1" is the child's own folder and the seventh level; "Folder 7" is the outermost. + assert_eq!(r.app.engine.session().track(parent).unwrap().name, "Folder 7"); + assert!(r.text_x(&child_name) > r.text_x("Folder 1"), "deeply nested child is not indented under its own folder"); + assert!(r.text_x("Folder 1") > r.text_x("Folder 2"), "each level indents further"); }