Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
windows: Fix opening wrong path when clicking path in the terminal view (#18726)
张小白3ff52a816e4a
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rsindex 28a3d61d654..b2cbae0dfe6 100644--- a/crates/terminal_view/src/terminal_view.rs+++ b/crates/terminal_view/src/terminal_view.rs@@ -798,6 +798,7 @@ fn possible_open_paths_metadata(cx.background_executor().spawn(async move {let mut paths_with_metadata = Vec::with_capacity(potential_paths.len());+ #[cfg(not(target_os = "windows"))]let mut fetch_metadata_tasks = potential_paths.into_iter().map(|potential_path| async {@@ -813,6 +814,20 @@ fn possible_open_paths_metadata(}).collect::<FuturesUnordered<_>>();+ #[cfg(target_os = "windows")]+ let mut fetch_metadata_tasks = potential_paths+ .iter()+ .map(|potential_path| async {+ let metadata = fs.metadata(potential_path).await.ok().flatten();+ let path = PathBuf::from(+ potential_path+ .to_string_lossy()+ .trim_start_matches("\\\\?\\"),+ );+ (PathWithPosition { path, row, column }, metadata)+ })+ .collect::<FuturesUnordered<_>>();+while let Some((path, metadata)) = fetch_metadata_tasks.next().await {if let Some(metadata) = metadata {paths_with_metadata.push((path, metadata));