diff options
| -rw-r--r-- | Cargo.lock | 10 | ||||
| -rw-r--r-- | Cargo.toml | 4 | ||||
| -rw-r--r-- | src/panes/code_view.rs | 12 |
3 files changed, 19 insertions, 7 deletions
@@ -2003,6 +2003,7 @@ dependencies = [ "fxhash", "iced", "iced_anim", + "iced_custom_highlighter", "iced_drop", "iced_fontello", "rfd", @@ -2039,6 +2040,15 @@ dependencies = [ ] [[package]] +name = "iced_custom_highlighter" +version = "0.1.0" +source = "git+https://github.com/pml68/iced_custom_highlighter?branch=fix%2Ftemp-update-on-theme-changed#f780df7c0c65417731e9cd34143ae902796b7bbf" +dependencies = [ + "iced_widget", + "syntect", +] + +[[package]] name = "iced_drop" version = "0.1.0" source = "git+https://github.com/jhannyj/iced_drop?rev=d259ec4dff098852d995d3bcaa5551a88330636f#d259ec4dff098852d995d3bcaa5551a88330636f" @@ -31,6 +31,10 @@ rev = "d259ec4dff098852d995d3bcaa5551a88330636f" [target.'cfg(target_os = "macos")'.dependencies] xdg = "2.5.2" +[dependencies.iced_custom_highlighter] +git = "https://github.com/pml68/iced_custom_highlighter" +branch = "fix/temp-update-on-theme-changed" + [build-dependencies] iced_fontello = "0.13.1" diff --git a/src/panes/code_view.rs b/src/panes/code_view.rs index f545157..b328722 100644 --- a/src/panes/code_view.rs +++ b/src/panes/code_view.rs @@ -1,5 +1,7 @@ use iced::widget::{button, pane_grid, row, text, text_editor, Space}; use iced::{Alignment, Font, Length, Theme}; +use iced_custom_highlighter::{Highlight, Highlighter, Settings}; + use super::style; use crate::icon::copy; use crate::types::{DesignerPage, Message}; @@ -29,14 +31,10 @@ pub fn view( pane_grid::Content::new( text_editor(editor_content) .on_action(Message::EditorAction) - .highlight( - "rs", - if theme.to_string().contains("Dark") { - highlighter::Theme::SolarizedDark - } else { - highlighter::Theme::InspiredGitHub - }, .font(Font::MONOSPACE) + .highlight_with::<Highlighter>( + Settings::new(vec![], Highlight::default_style, theme, "rs"), + Highlight::to_format, ) .height(Length::Fill) .padding(20), |
