diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/editor/src/main.rs | 21 | ||||
-rw-r--r-- | examples/markdown/src/main.rs | 10 |
2 files changed, 10 insertions, 21 deletions
diff --git a/examples/editor/src/main.rs b/examples/editor/src/main.rs index 9ffb4d1a..155e74a1 100644 --- a/examples/editor/src/main.rs +++ b/examples/editor/src/main.rs @@ -1,4 +1,4 @@ -use iced::highlighter::{self, Highlighter}; +use iced::highlighter; use iced::keyboard; use iced::widget::{ button, column, container, horizontal_space, pick_list, row, text, @@ -186,18 +186,13 @@ impl Editor { text_editor(&self.content) .height(Fill) .on_action(Message::ActionPerformed) - .highlight::<Highlighter>( - highlighter::Settings { - theme: self.theme, - token: self - .file - .as_deref() - .and_then(Path::extension) - .and_then(ffi::OsStr::to_str) - .map(str::to_string) - .unwrap_or(String::from("rs")), - }, - |highlight, _theme| highlight.to_format() + .highlight( + self.file + .as_deref() + .and_then(Path::extension) + .and_then(ffi::OsStr::to_str) + .unwrap_or("rs"), + self.theme, ), status, ] diff --git a/examples/markdown/src/main.rs b/examples/markdown/src/main.rs index ade6e453..eb51f985 100644 --- a/examples/markdown/src/main.rs +++ b/examples/markdown/src/main.rs @@ -1,4 +1,4 @@ -use iced::highlighter::{self, Highlighter}; +use iced::highlighter; use iced::widget::{self, markdown, row, scrollable, text_editor}; use iced::{Element, Fill, Font, Task, Theme}; @@ -65,13 +65,7 @@ impl Markdown { .height(Fill) .padding(10) .font(Font::MONOSPACE) - .highlight::<Highlighter>( - highlighter::Settings { - theme: highlighter::Theme::Base16Ocean, - token: "markdown".to_owned(), - }, - |highlight, _theme| highlight.to_format(), - ); + .highlight("markdown", highlighter::Theme::Base16Ocean); let preview = markdown(&self.items, markdown::Settings::default()) .map(Message::LinkClicked); |