Skip to content

Commit

Permalink
Update iced for markdown link support
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Jul 24, 2024
1 parent 5e60069 commit 21f1a9d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
23 changes: 12 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false

[dependencies]
iced.git = "https://github.com/iced-rs/iced.git"
iced.rev = "4b44079f34aa9e01977a7974e5f49ae79ff6cd90"
iced.rev = "faa5d0c58d6174091253fd55820d286c23b80ab4"
iced.features = ["tokio", "svg", "markdown", "highlighter", "system", "web-colors", "debug"]

tokio.version = "1.38"
Expand Down
16 changes: 12 additions & 4 deletions src/screen/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub enum Message {
Boot,
Abort,
UseCUDAToggled(bool),
LinkClicked(markdown::Url),
}

pub enum Action {
Expand Down Expand Up @@ -93,6 +94,11 @@ impl Boot {
Message::UseCUDAToggled(use_cuda) => {
self.use_cuda = use_cuda;

Action::None
}
Message::LinkClicked(url) => {
let _ = open::that_in_background(url.to_string());

Action::None
}
}
Expand Down Expand Up @@ -149,10 +155,12 @@ impl Boot {
])
.into()
} else {
scrollable(markdown(&self.readme))
.spacing(10)
.height(Fill)
.into()
scrollable(
markdown(&self.readme, markdown::Settings::default()).map(Message::LinkClicked),
)
.spacing(10)
.height(Fill)
.into()
};

center(
Expand Down
2 changes: 1 addition & 1 deletion src/screen/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl Search {
}
Message::RunModel(model) => Action::Boot(model),
Message::LinkPressed(link) => {
let _ = open::that(match link {
let _ = open::that_in_background(match link {
Link::Rust => "https://rust-lang.org",
Link::Iced => "https://iced.rs",
Link::HuggingFace => "https://huggingface.co",
Expand Down

0 comments on commit 21f1a9d

Please sign in to comment.