summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Cargo.lock10
-rw-r--r--Cargo.toml4
-rw-r--r--src/panes/code_view.rs12
3 files changed, 19 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a638ff4..af254a0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -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"
diff --git a/Cargo.toml b/Cargo.toml
index 1f97ff3..f83f3c8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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),