From 2b0c60043dee6b1f881f5fea0f1554c0f4e733b4 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Mon, 29 Jul 2024 17:46:52 +0200 Subject: [PATCH] file finder: Fix `./` breaking new-path prompt (#15438) Fixes #15426. The `./` was implicitly assumed to be there by the prompt, so we'd end up with `././foobar` when typing in an explicit `./`. This fixes the issue by stripping `./` from the query, like we also strip `/`. Release Notes: - Fixed paths starting with `./` breaking the new-path file picker when the system prompts are disabled. ([#15426](https://github.com/zed-industries/zed/issues/15426)). --- crates/file_finder/src/new_path_prompt.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/file_finder/src/new_path_prompt.rs b/crates/file_finder/src/new_path_prompt.rs index 206545f5b4acdeee824a1a432d07576cd8bf609d..2d5be8dae12ec2e540ea32b08fbd750b8ef6dc0c 100644 --- a/crates/file_finder/src/new_path_prompt.rs +++ b/crates/file_finder/src/new_path_prompt.rs @@ -248,7 +248,10 @@ impl PickerDelegate for NewPathDelegate { query: String, cx: &mut ViewContext>, ) -> gpui::Task<()> { - let query = query.trim().trim_start_matches('/'); + let query = query + .trim() + .trim_start_matches("./") + .trim_start_matches('/'); let (dir, suffix) = if let Some(index) = query.rfind('/') { let suffix = if index + 1 < query.len() { Some(query[index + 1..].to_string())