file_finder: Fix crash in new_path_prompt (#16991)
Closes #16919 repro step: - add two worktree - modify settings `"use_system_path_prompts" : false` - `ctrl-n` create new file, typing any chars. - `ctrl-s` save file - typing any char, crashed. Release Notes: - Fixed crashed when setting `"use_system_path_prompts": false` or in remote project with two or more worktree.
This commit is contained in:
parent
d715fea258
commit
0853cb573f
1 changed files with 3 additions and 1 deletions
|
@ -107,8 +107,10 @@ impl Match {
|
||||||
|
|
||||||
if let Some(path_match) = &self.path_match {
|
if let Some(path_match) = &self.path_match {
|
||||||
text.push_str(&path_match.path.to_string_lossy());
|
text.push_str(&path_match.path.to_string_lossy());
|
||||||
|
let mut whole_path = PathBuf::from(path_match.path_prefix.to_string());
|
||||||
|
whole_path = whole_path.join(path_match.path.clone());
|
||||||
for (range, style) in highlight_ranges(
|
for (range, style) in highlight_ranges(
|
||||||
&path_match.path.to_string_lossy(),
|
&whole_path.to_string_lossy(),
|
||||||
&path_match.positions,
|
&path_match.positions,
|
||||||
gpui::HighlightStyle::color(Color::Accent.color(cx)),
|
gpui::HighlightStyle::color(Color::Accent.color(cx)),
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue