diff options
| author | 2024-07-28 23:59:51 +0200 | |
|---|---|---|
| committer | 2024-07-28 23:59:51 +0200 | |
| commit | 16212eaf52657ea47bba7add7deac378d0bf4b4a (patch) | |
| tree | 27feb673ab07016a48ee1ae491fa7331a349cabb /examples/editor/src | |
| parent | 1aa0a8fa0d8e5dfe9ab09a11ea7c69f71e19795b (diff) | |
| download | iced-16212eaf52657ea47bba7add7deac378d0bf4b4a.tar.gz iced-16212eaf52657ea47bba7add7deac378d0bf4b4a.tar.bz2 iced-16212eaf52657ea47bba7add7deac378d0bf4b4a.zip | |
Simplify `highlight` method for `text_editor` widget
Diffstat (limited to '')
| -rw-r--r-- | examples/editor/src/main.rs | 21 | 
1 files changed, 8 insertions, 13 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,          ] | 
