diff options
| -rw-r--r-- | .cargo/config.toml | 3 | ||||
| -rw-r--r-- | src/panes/code_view.rs | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml index feb6aad..669a8c7 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,6 @@ [alias] lint = "clippy --no-deps -- -D warnings" lint-all = "clippy --no-deps -- -D clippy::pedantic" + +[build] +rustflags = ["-Z", "threads=6"] diff --git a/src/panes/code_view.rs b/src/panes/code_view.rs index 7712d4d..956eb87 100644 --- a/src/panes/code_view.rs +++ b/src/panes/code_view.rs @@ -1,12 +1,23 @@ +use iced::advanced::text::highlighter::Format; use iced::widget::{button, pane_grid, row, text, text_editor, Space}; use iced::{Alignment, Background, Border, Font, Length, Theme}; -use iced_custom_highlighter::{Highlight, Highlighter, Settings}; +use iced_custom_highlighter::{Highlight, Highlighter, Scope, Settings}; use super::style; use crate::icon::copy; use crate::types::{DesignerPage, Message}; use crate::widget::tip; +fn highlight_style(theme: &Theme, scope: &Scope) -> Format<Font> { + match scope { + Scope::Custom { .. } | Scope::Other => Format { + color: Some(theme.extended_palette().primary.strong.color), + font: None, + }, + _ => Highlight::default_style(theme, scope), + } +} + pub fn view( editor_content: &text_editor::Content, theme: Theme, @@ -33,7 +44,7 @@ pub fn view( .on_action(Message::EditorAction) .font(Font::MONOSPACE) .highlight_with::<Highlighter>( - Settings::new(vec![], Highlight::default_style, theme, "rs"), + Settings::new(vec![], highlight_style, theme, "rs"), Highlight::to_format, ) .style(|theme, _| { |
