Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
terminal_view: Use backslash escaping for dropped file paths for mac (#57747)
mertkanakkoc7e0f63412c60
diff --git a/Cargo.lock b/Cargo.lockindex c3ae43b5a9c..2445366c126 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -535,6 +535,7 @@ dependencies = ["serde_json","serde_json_lenient","settings",+ "shlex","streaming_diff","task","telemetry",@@ -18419,6 +18420,7 @@ dependencies = ["serde_json","settings","shellexpand",+ "shlex","task","terminal","theme",diff --git a/crates/agent_ui/Cargo.toml b/crates/agent_ui/Cargo.tomlindex 8b25804d724..822b91c3cd1 100644--- a/crates/agent_ui/Cargo.toml+++ b/crates/agent_ui/Cargo.toml@@ -143,6 +143,7 @@ remote_server = { workspace = true, features = ["test-support"] }search = { workspace = true, features = ["test-support"] }semver.workspace = true+shlex.workspace = truereqwest_client.workspace = truetempfile.workspace = truevim.workspace = truediff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 7fe2d2c0b9f..88d8a5fd86d 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -9038,7 +9038,7 @@ mod tests {let mut text = String::new();for path in paths {text.push(' ');- text.push_str(&format!("{path:?}"));+ text.push_str(&shlex::try_quote(path.to_str().unwrap()).unwrap());}text.push(' ');textdiff --git a/crates/terminal_view/Cargo.toml b/crates/terminal_view/Cargo.tomlindex 9da4c5ec6e1..5197dee517a 100644--- a/crates/terminal_view/Cargo.toml+++ b/crates/terminal_view/Cargo.toml@@ -32,13 +32,14 @@ menu.workspace = truepretty_assertions.workspace = trueproject.workspace = trueregex.workspace = true-task.workspace = trueschemars.workspace = true+task.workspace = trueserde.workspace = trueserde_json.workspace = truesettings.workspace = trueshellexpand.workspace = true+shlex.workspace = trueterminal.workspace = truetheme.workspace = truetheme_settings.workspace = truediff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rsindex 6511497623a..ea888d564cc 100644--- a/crates/terminal_view/src/terminal_view.rs+++ b/crates/terminal_view/src/terminal_view.rs@@ -959,7 +959,7 @@ impl TerminalView {pub fn add_paths_to_terminal(&self, paths: &[PathBuf], window: &mut Window, cx: &mut App) {let mut text = paths.iter()- .map(|path| format!(" {path:?}"))+ .filter_map(|path| Some(format!(" {}", shlex::try_quote(path.to_str()?).ok()?))).collect::<String>();text.push(' ');window.focus(&self.focus_handle(cx), cx);@@ -2176,7 +2176,7 @@ mod tests {let mut text = String::new();for path in paths {text.push(' ');- text.push_str(&format!("{path:?}"));+ text.push_str(&shlex::try_quote(path.to_str().unwrap()).unwrap());}text.push(' ');text