mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 17:36:19 +04:00
Clean up global search
This commit is contained in:
parent
92bb312f0f
commit
1849ad1fde
@ -1712,39 +1712,37 @@ fn global_search(cx: &mut Context) {
|
|||||||
.max_depth(file_picker_config.max_depth)
|
.max_depth(file_picker_config.max_depth)
|
||||||
.build_parallel()
|
.build_parallel()
|
||||||
.run(|| {
|
.run(|| {
|
||||||
let mut searcher_cl = searcher.clone();
|
let mut searcher = searcher.clone();
|
||||||
let matcher_cl = matcher.clone();
|
let matcher = matcher.clone();
|
||||||
let all_matches_sx_cl = all_matches_sx.clone();
|
let all_matches_sx = all_matches_sx.clone();
|
||||||
Box::new(move |dent: Result<DirEntry, ignore::Error>| -> WalkState {
|
Box::new(move |entry: Result<DirEntry, ignore::Error>| -> WalkState {
|
||||||
let dent = match dent {
|
let entry = match entry {
|
||||||
Ok(dent) => dent,
|
Ok(entry) => entry,
|
||||||
Err(_) => return WalkState::Continue,
|
Err(_) => return WalkState::Continue,
|
||||||
};
|
};
|
||||||
|
|
||||||
match dent.file_type() {
|
match entry.file_type() {
|
||||||
Some(fi) => {
|
Some(entry) if entry.is_file() => {}
|
||||||
if !fi.is_file() {
|
// skip everything else
|
||||||
return WalkState::Continue;
|
_ => return WalkState::Continue,
|
||||||
}
|
};
|
||||||
}
|
|
||||||
None => return WalkState::Continue,
|
|
||||||
}
|
|
||||||
|
|
||||||
let result_sink = sinks::UTF8(|line_num, _| {
|
let result = searcher.search_path(
|
||||||
match all_matches_sx_cl
|
&matcher,
|
||||||
.send((line_num as usize - 1, dent.path().to_path_buf()))
|
entry.path(),
|
||||||
{
|
sinks::UTF8(|line_num, _| {
|
||||||
Ok(_) => Ok(true),
|
all_matches_sx
|
||||||
Err(_) => Ok(false),
|
.send((line_num as usize - 1, entry.path().to_path_buf()))
|
||||||
}
|
.unwrap();
|
||||||
});
|
|
||||||
let result =
|
Ok(true)
|
||||||
searcher_cl.search_path(&matcher_cl, dent.path(), result_sink);
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
if let Err(err) = result {
|
if let Err(err) = result {
|
||||||
log::error!(
|
log::error!(
|
||||||
"Global search error: {}, {}",
|
"Global search error: {}, {}",
|
||||||
dent.path().display(),
|
entry.path().display(),
|
||||||
err
|
err
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user