mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Open paths starting with ~ from terminal click
This commit is contained in:
parent
7788eabec0
commit
dcaf8a9af8
@ -76,7 +76,7 @@ lazy_static! {
|
||||
// Regex Copied from alacritty's ui_config.rs
|
||||
static ref URL_REGEX: RegexSearch = RegexSearch::new(r#"(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file://|git://|ssh:|ftp://)[^\u{0000}-\u{001F}\u{007F}-\u{009F}<>"\s{-}\^⟨⟩`]+"#).unwrap();
|
||||
|
||||
static ref WORD_REGEX: RegexSearch = RegexSearch::new("[\\w.:/@-]+").unwrap();
|
||||
static ref WORD_REGEX: RegexSearch = RegexSearch::new("[\\w.:/@-~]+").unwrap();
|
||||
}
|
||||
|
||||
///Upward flowing events, for changing the title and such
|
||||
|
@ -425,6 +425,16 @@ fn possible_open_targets(
|
||||
let maybe_path = path_like.path_like;
|
||||
let potential_abs_paths = if maybe_path.is_absolute() {
|
||||
vec![maybe_path]
|
||||
} else if maybe_path.starts_with("~") {
|
||||
if let Some(abs_path) = maybe_path
|
||||
.strip_prefix("~")
|
||||
.ok()
|
||||
.and_then(|maybe_path| Some(dirs::home_dir()?.join(maybe_path)))
|
||||
{
|
||||
vec![abs_path]
|
||||
} else {
|
||||
Vec::new()
|
||||
}
|
||||
} else if let Some(workspace) = workspace.upgrade(cx) {
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
workspace
|
||||
|
Loading…
Reference in New Issue
Block a user