diff --git a/src/main.rs b/src/main.rs index fd9e14d..201c89a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1540,7 +1540,9 @@ impl Command { .profiles .iter() .enumerate() - .filter(|(_, profile)| fuzzy_match(&profile.name, query)) + .filter(|(_, profile)| { + fuzzy_match(&profile.name, query) || fuzzy_match(&folder.path, query) + }) .map(|(profile_index, _)| Self::SelectProfile { folder: folder_index, profile: profile_index, @@ -12508,6 +12510,22 @@ mod tests { assert_eq!(window_state(&state).active_tab, Some(Tab::Start)); } + #[test] + fn command_palette_finds_profiles_by_folder_path() { + let mut state = state(); + let window = test_window(); + state.profile_folders[0].path = "Work/Production".to_owned(); + state.profile_folders[0].profiles.push(profile("Alpha")); + + assert_eq!( + super::Command::matching(&state, window, "production"), + vec![super::Command::SelectProfile { + folder: 0, + profile: 0 + }] + ); + } + fn press(key: keyboard::Key, modifiers: keyboard::Modifiers) -> Message { Message::CaptureKey { key, modifiers } }