|
|
@ -1291,7 +1291,8 @@ fn global_search(cx: &mut Context) {
|
|
|
|
|
|
|
|
|
|
|
|
cx.push_layer(Box::new(prompt));
|
|
|
|
cx.push_layer(Box::new(prompt));
|
|
|
|
|
|
|
|
|
|
|
|
let root = find_root(None).unwrap_or_else(|| PathBuf::from("./"));
|
|
|
|
let current_path = doc_mut!(cx.editor).path().cloned();
|
|
|
|
|
|
|
|
|
|
|
|
let show_picker = async move {
|
|
|
|
let show_picker = async move {
|
|
|
|
let all_matches: Vec<(usize, PathBuf)> =
|
|
|
|
let all_matches: Vec<(usize, PathBuf)> =
|
|
|
|
UnboundedReceiverStream::new(all_matches_rx).collect().await;
|
|
|
|
UnboundedReceiverStream::new(all_matches_rx).collect().await;
|
|
|
@ -1301,14 +1302,19 @@ fn global_search(cx: &mut Context) {
|
|
|
|
editor.set_status("No matches found".to_string());
|
|
|
|
editor.set_status("No matches found".to_string());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let picker = FilePicker::new(
|
|
|
|
let picker = FilePicker::new(
|
|
|
|
all_matches,
|
|
|
|
all_matches,
|
|
|
|
move |(_line_num, path)| {
|
|
|
|
move |(_line_num, path)| {
|
|
|
|
path.strip_prefix(&root)
|
|
|
|
let relative_path = helix_core::path::get_relative_path(path)
|
|
|
|
.unwrap_or(path)
|
|
|
|
|
|
|
|
.to_str()
|
|
|
|
.to_str()
|
|
|
|
.unwrap()
|
|
|
|
.unwrap()
|
|
|
|
.into()
|
|
|
|
.to_owned();
|
|
|
|
|
|
|
|
if current_path.as_ref().map(|p| p == path).unwrap_or(false) {
|
|
|
|
|
|
|
|
format!("{} (*)", relative_path).into()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
relative_path.into()
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
move |editor: &mut Editor, (line_num, path), action| {
|
|
|
|
move |editor: &mut Editor, (line_num, path), action| {
|
|
|
|
match editor.open(path.into(), action) {
|
|
|
|
match editor.open(path.into(), action) {
|
|
|
|