Use open_url from the platform module
And remove the open function from the `util` crate.
This commit is contained in:
parent
015b8db1c3
commit
7a667f390b
3 changed files with 4 additions and 19 deletions
|
@ -731,7 +731,7 @@ impl Terminal {
|
||||||
|
|
||||||
if let Some((url, url_match)) = found_url {
|
if let Some((url, url_match)) = found_url {
|
||||||
if *open {
|
if *open {
|
||||||
util::open(&url);
|
cx.platform().open_url(url.as_str());
|
||||||
} else {
|
} else {
|
||||||
self.update_hyperlink(prev_hyperlink, url, url_match);
|
self.update_hyperlink(prev_hyperlink, url, url_match);
|
||||||
}
|
}
|
||||||
|
@ -1072,7 +1072,7 @@ impl Terminal {
|
||||||
if self.selection_phase == SelectionPhase::Ended {
|
if self.selection_phase == SelectionPhase::Ended {
|
||||||
let mouse_cell_index = content_index_for_mouse(position, &self.last_content);
|
let mouse_cell_index = content_index_for_mouse(position, &self.last_content);
|
||||||
if let Some(link) = self.last_content.cells[mouse_cell_index].hyperlink() {
|
if let Some(link) = self.last_content.cells[mouse_cell_index].hyperlink() {
|
||||||
util::open(link.uri());
|
cx.platform().open_url(link.uri());
|
||||||
} else {
|
} else {
|
||||||
self.events
|
self.events
|
||||||
.push_back(InternalEvent::FindHyperlink(position, true));
|
.push_back(InternalEvent::FindHyperlink(position, true));
|
||||||
|
|
|
@ -9,7 +9,6 @@ use rand::{seq::SliceRandom, Rng};
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
ops::AddAssign,
|
ops::AddAssign,
|
||||||
path::Path,
|
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
@ -54,17 +53,6 @@ pub fn truncate_and_trailoff(s: &str, max_chars: usize) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open<P: AsRef<Path>>(path: P) {
|
|
||||||
let path_to_open = path.as_ref().to_string_lossy();
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
{
|
|
||||||
std::process::Command::new("open")
|
|
||||||
.arg(path_to_open.as_ref())
|
|
||||||
.spawn()
|
|
||||||
.log_err();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn post_inc<T: From<u8> + AddAssign<T> + Copy>(value: &mut T) -> T {
|
pub fn post_inc<T: From<u8> + AddAssign<T> + Copy>(value: &mut T) -> T {
|
||||||
let prev = *value;
|
let prev = *value;
|
||||||
*value += T::from(1);
|
*value += T::from(1);
|
||||||
|
|
|
@ -146,11 +146,8 @@ pub mod simple_message_notification {
|
||||||
pub fn init(cx: &mut MutableAppContext) {
|
pub fn init(cx: &mut MutableAppContext) {
|
||||||
cx.add_action(MessageNotification::dismiss);
|
cx.add_action(MessageNotification::dismiss);
|
||||||
cx.add_action(
|
cx.add_action(
|
||||||
|_workspace: &mut Workspace, open_action: &OsOpen, _cx: &mut ViewContext<Workspace>| {
|
|_workspace: &mut Workspace, open_action: &OsOpen, cx: &mut ViewContext<Workspace>| {
|
||||||
#[cfg(target_os = "macos")]
|
cx.platform().open_url(open_action.0.as_str());
|
||||||
{
|
|
||||||
util::open(&open_action.0);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue