summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-01-14 18:43:06 +0100
committerpml68 <contact@pml68.dev>2025-01-14 18:43:06 +0100
commit563b8109f0cdadeeb6f6b12f49e93f591bf94e34 (patch)
treeb371ac3bb98181d8abd6d210057b7f7bc5959699 /src
parentfeat: add `-V` and `--version` flags (diff)
downloadiced-builder-563b8109f0cdadeeb6f6b12f49e93f591bf94e34.tar.gz
feat: add iced_custom_highlighter
Diffstat (limited to '')
-rw-r--r--src/panes/code_view.rs12
1 files changed, 5 insertions, 7 deletions
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),