mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-23 23:09:42 +00:00
Replace home directory with the tilde substitution
This commit is contained in:
parent
056f4e914f
commit
87c1b190a8
3 changed files with 12 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -5014,6 +5014,7 @@ dependencies = [
|
|||
"settings",
|
||||
"smol",
|
||||
"text",
|
||||
"util",
|
||||
"workspace",
|
||||
]
|
||||
|
||||
|
|
|
@ -21,3 +21,4 @@ workspace = { path = "../workspace" }
|
|||
ordered-float = "2.1.1"
|
||||
postage = { workspace = true }
|
||||
smol = "1.2"
|
||||
util = { path = "../util"}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use fuzzy::StringMatch;
|
||||
use gpui::{
|
||||
|
@ -61,8 +61,16 @@ impl HighlightedWorkspaceLocation {
|
|||
.paths()
|
||||
.iter()
|
||||
.map(|path| {
|
||||
let mut full_path = PathBuf::new();
|
||||
if path.starts_with(util::paths::HOME.as_path()) {
|
||||
full_path.push("~");
|
||||
full_path.push(path.strip_prefix(util::paths::HOME.as_path()).unwrap());
|
||||
} else {
|
||||
full_path.push(path)
|
||||
}
|
||||
|
||||
let highlighted_text = Self::highlights_for_path(
|
||||
path.as_ref(),
|
||||
full_path.as_ref(),
|
||||
&string_match.positions,
|
||||
path_start_offset,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue