Skip to content

Commit

Permalink
Update to egui 0.28.0 (#51)
Browse files Browse the repository at this point in the history
* Update to egui master

* Update to latest egui main

* post merge fixes

* update egui commit

* Update to egui 0.28.0

* Update examples with no unwrap

* Revert accidental change

* Revert accidental change

* Revert accidental change

---------

Co-authored-by: Antoine Beyeler <[email protected]>
  • Loading branch information
emilk and abey79 authored Jul 3, 2024
1 parent 4c45321 commit ed5b00f
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 35 deletions.
14 changes: 10 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = [
"egui_commonmark",
"egui_commonmark_macros",
"egui_commonmark_backend"
"egui_commonmark_backend",
]

resolver = "2"
Expand All @@ -11,13 +11,13 @@ resolver = "2"
[workspace.package]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.76" # Follows egui
rust-version = "1.76" # Follows egui
version = "0.16.1"
repository = "https://github.com/lampsitter/egui_commonmark"

[workspace.dependencies]
egui_extras = "0.27"
egui = "0.27"
egui_extras = "0.28"
egui = "0.28"

egui_commonmark_backend = { version = "0.16.0", path = "egui_commonmark_backend", default-features = false }
egui_commonmark_macros = { version = "0.16.0", path = "egui_commonmark_macros", default-features = false }
Expand All @@ -26,3 +26,9 @@ egui_commonmark_macros = { version = "0.16.0", path = "egui_commonmark_macros",
document-features = { version = "0.2" }

pulldown-cmark = { version = "0.11", default-features = false }


[patch.crates-io]
# eframe = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
# egui = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
# egui_extras = { git = "https://github.com/emilk/egui.git", rev = "cbb5d6aa936c7498214dba03b594fbe75dbe7488" } # egui master 2024-06-05
4 changes: 2 additions & 2 deletions egui_commonmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ svg = ["egui_extras/svg"]
fetch = ["egui_extras/http"]

[dev-dependencies]
eframe = { version = "0.27", default-features = false, features = ["default_fonts", "glow"] }
image = { version = "0.24", default-features = false, features = ["png"] }
eframe = { version = "0.28", default-features = false, features = ["default_fonts", "glow"] }
image = { version = "0.25", default-features = false, features = ["png"] }
egui_commonmark_macros = { workspace = true } # Tests won't build otherswise

[package.metadata.docs.rs]
Expand Down
10 changes: 5 additions & 5 deletions egui_commonmark/examples/book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() {
fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

let _ = eframe::run_native(
eframe::run_native(
&format!("Markdown viewer (backend '{}')", BACKEND),
eframe::NativeOptions::default(),
Box::new(move |cc| {
Expand All @@ -97,7 +97,7 @@ fn main() {
style.url_in_tooltip = true;
});

Box::new(App {
Ok(Box::new(App {
cache: CommonMarkCache::default(),
curr_tab: Some(0),
pages: vec![
Expand Down Expand Up @@ -126,7 +126,7 @@ fn main() {
content: include_str!("markdown/tables.md").to_owned(),
},
],
})
}))
}),
);
)
}
7 changes: 3 additions & 4 deletions egui_commonmark/examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() {
fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

Expand All @@ -50,10 +50,9 @@ fn main() {
style.url_in_tooltip = true;
});

Box::new(App {
Ok(Box::new(App {
cache: CommonMarkCache::default(),
})
}))
}),
)
.unwrap();
}
7 changes: 3 additions & 4 deletions egui_commonmark/examples/link_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() {
fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

Expand All @@ -65,11 +65,10 @@ fn main() {
cache.add_link_hook("#next");
cache.add_link_hook("#prev");

Box::new(App {
Ok(Box::new(App {
cache,
curr_page: 0,
})
}))
}),
)
.unwrap();
}
7 changes: 3 additions & 4 deletions egui_commonmark/examples/macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl eframe::App for App {
}
}

fn main() {
fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

Expand All @@ -98,10 +98,9 @@ fn main() {
style.url_in_tooltip = true;
});

Box::new(App {
Ok(Box::new(App {
cache: CommonMarkCache::default(),
})
}))
}),
)
.unwrap();
}
7 changes: 3 additions & 4 deletions egui_commonmark/examples/scroll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() {
fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

Expand All @@ -68,10 +68,9 @@ fn main() {
style.url_in_tooltip = true;
});

Box::new(App {
Ok(Box::new(App {
cache: CommonMarkCache::default(),
})
}))
}),
)
.unwrap();
}
7 changes: 3 additions & 4 deletions egui_commonmark/examples/show_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const BACKEND: &str = "comrak";
#[cfg(feature = "pulldown_cmark")]
const BACKEND: &str = "pulldown_cmark";

fn main() {
fn main() -> eframe::Result {
let mut args = std::env::args();
args.next();

Expand All @@ -52,13 +52,12 @@ fn main() {
style.url_in_tooltip = true;
});

Box::new(App {
Ok(Box::new(App {
cache: CommonMarkCache::default(),
text_buffer: EXAMPLE_TEXT.into(),
})
}))
}),
)
.unwrap();
}

const EXAMPLE_TEXT: &str = "
Expand Down
8 changes: 4 additions & 4 deletions egui_commonmark_backend/src/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ pub fn blockquote(ui: &mut Ui, accent: egui::Color32, add_contents: impl FnOnce(

ui.painter().set(
start,
egui::epaint::Shape::LineSegment {
points: [
egui::epaint::Shape::line_segment(
[
egui::pos2(response.rect.left_top().x, response.rect.left_top().y + 5.0),
egui::pos2(
response.rect.left_bottom().x,
response.rect.left_bottom().y - 5.0,
),
],
stroke: egui::Stroke::new(3.0, accent),
},
egui::Stroke::new(3.0, accent),
),
);
}

0 comments on commit ed5b00f

Please sign in to comment.