summaryrefslogtreecommitdiffstats
path: root/core/src/text
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-18 14:38:54 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-18 14:38:54 +0200
commit8446fe6de52fa68077d23d39f728f79a29b52f00 (patch)
tree937c0c1817afb1ab6cc95499f253938549cda68b /core/src/text
parent61ef8f3249218b301d434d04c483ba70562c1df4 (diff)
downloadiced-8446fe6de52fa68077d23d39f728f79a29b52f00.tar.gz
iced-8446fe6de52fa68077d23d39f728f79a29b52f00.tar.bz2
iced-8446fe6de52fa68077d23d39f728f79a29b52f00.zip
Implement theme selector in `editor` example
Diffstat (limited to 'core/src/text')
-rw-r--r--core/src/text/highlighter.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/src/text/highlighter.rs b/core/src/text/highlighter.rs
index a929826f..b462d083 100644
--- a/core/src/text/highlighter.rs
+++ b/core/src/text/highlighter.rs
@@ -1,10 +1,9 @@
use crate::Color;
-use std::hash::Hash;
use std::ops::Range;
pub trait Highlighter: 'static {
- type Settings: Hash;
+ type Settings: PartialEq + Clone;
type Highlight;
type Iterator<'a>: Iterator<Item = (Range<usize>, Self::Highlight)>
@@ -13,6 +12,8 @@ pub trait Highlighter: 'static {
fn new(settings: &Self::Settings) -> Self;
+ fn update(&mut self, new_settings: &Self::Settings);
+
fn change_line(&mut self, line: usize);
fn highlight_line(&mut self, line: &str) -> Self::Iterator<'_>;
@@ -38,6 +39,8 @@ impl Highlighter for PlainText {
Self
}
+ fn update(&mut self, _new_settings: &Self::Settings) {}
+
fn change_line(&mut self, _line: usize) {}
fn highlight_line(&mut self, _line: &str) -> Self::Iterator<'_> {