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)).
This commit is contained in:
parent
0b4afe518b
commit
2b0c60043d
1 changed files with 4 additions and 1 deletions
|
@ -248,7 +248,10 @@ impl PickerDelegate for NewPathDelegate {
|
|||
query: String,
|
||||
cx: &mut ViewContext<picker::Picker<Self>>,
|
||||
) -> 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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue