Avoid adding unnecessary spans when syntax highlighting
This commit is contained in:
parent
790c0dabcf
commit
86d396cf8b
2 changed files with 14 additions and 12 deletions
|
|
@ -154,7 +154,7 @@ winit = { git = "https://github.com/iced-rs/winit.git", rev = "c52db2045d0a2f1b8
|
||||||
|
|
||||||
[patch.crates-io.cosmic-text]
|
[patch.crates-io.cosmic-text]
|
||||||
git = "https://github.com/hecrj/cosmic-text.git"
|
git = "https://github.com/hecrj/cosmic-text.git"
|
||||||
rev = "cb83458e7d0b84ef37c5beb72dda5046d7d343a6"
|
branch = "editor-fixes"
|
||||||
|
|
||||||
[patch.crates-io.rangemap]
|
[patch.crates-io.rangemap]
|
||||||
git = "https://github.com/hecrj/rangemap.git"
|
git = "https://github.com/hecrj/rangemap.git"
|
||||||
|
|
|
||||||
|
|
@ -569,6 +569,7 @@ impl editor::Editor for Editor {
|
||||||
for (range, highlight) in highlighter.highlight_line(line.text()) {
|
for (range, highlight) in highlighter.highlight_line(line.text()) {
|
||||||
let format = format_highlight(&highlight);
|
let format = format_highlight(&highlight);
|
||||||
|
|
||||||
|
if format.color.is_some() || format.font.is_some() {
|
||||||
list.add_span(
|
list.add_span(
|
||||||
range,
|
range,
|
||||||
cosmic_text::Attrs {
|
cosmic_text::Attrs {
|
||||||
|
|
@ -581,6 +582,7 @@ impl editor::Editor for Editor {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let _ = line.set_attrs_list(list);
|
let _ = line.set_attrs_list(list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue