Added fuzzy matching on profile path also
This commit is contained in:
1 parent
485cbf4c18
commit
e0de7a43f0
1 file changed
+19
-1
+19
-1
@@ -1540,7 +1540,9 @@ impl Command {
|
|||||||
.profiles
|
.profiles
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.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 {
|
.map(|(profile_index, _)| Self::SelectProfile {
|
||||||
folder: folder_index,
|
folder: folder_index,
|
||||||
profile: profile_index,
|
profile: profile_index,
|
||||||
@@ -12508,6 +12510,22 @@ mod tests {
|
|||||||
assert_eq!(window_state(&state).active_tab, Some(Tab::Start));
|
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 {
|
fn press(key: keyboard::Key, modifiers: keyboard::Modifiers) -> Message {
|
||||||
Message::CaptureKey { key, modifiers }
|
Message::CaptureKey { key, modifiers }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user