summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Cargo.toml2
-rw-r--r--graphics/src/text/editor.rs24
2 files changed, 14 insertions, 12 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 70f84460..ac59085d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -154,7 +154,7 @@ winit = { git = "https://github.com/iced-rs/winit.git", rev = "c52db2045d0a2f1b8
[patch.crates-io.cosmic-text]
git = "https://github.com/hecrj/cosmic-text.git"
-rev = "cb83458e7d0b84ef37c5beb72dda5046d7d343a6"
+branch = "editor-fixes"
[patch.crates-io.rangemap]
git = "https://github.com/hecrj/rangemap.git"
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs
index 47c210bd..95061c3c 100644
--- a/graphics/src/text/editor.rs
+++ b/graphics/src/text/editor.rs
@@ -569,17 +569,19 @@ impl editor::Editor for Editor {
for (range, highlight) in highlighter.highlight_line(line.text()) {
let format = format_highlight(&highlight);
- list.add_span(
- range,
- cosmic_text::Attrs {
- color_opt: format.color.map(text::to_color),
- ..if let Some(font) = format.font {
- text::to_attributes(font)
- } else {
- attributes
- }
- },
- );
+ if format.color.is_some() || format.font.is_some() {
+ list.add_span(
+ range,
+ cosmic_text::Attrs {
+ color_opt: format.color.map(text::to_color),
+ ..if let Some(font) = format.font {
+ text::to_attributes(font)
+ } else {
+ attributes
+ }
+ },
+ );
+ }
}
let _ = line.set_attrs_list(list);