Only reset lines where highlight changes

This commit is contained in:
Jeremy Soller 2022-10-26 21:27:29 -06:00
parent 6f7e59e092
commit f85223b376
2 changed files with 8 additions and 3 deletions

View file

@ -61,6 +61,9 @@ fn main() {
);
buffer.set_text(&text);
for line in buffer.lines.iter_mut() {
line.wrap_simple = true;
}
let mut bg_color = orbclient::Color::rgb(0x00, 0x00, 0x00);
let mut font_color = orbclient::Color::rgb(0xFF, 0xFF, 0xFF);
@ -152,9 +155,10 @@ fn main() {
start = end;
}
line.attrs_list = attrs_list;
line.wrap_simple = true;
line.reset();
if attrs_list != line.attrs_list {
line.attrs_list = attrs_list;
line.reset();
}
}
rehighlight = false;

View file

@ -90,6 +90,7 @@ impl<'a> Attrs<'a> {
}
}
#[derive(Eq, PartialEq)]
pub struct AttrsList<'a> {
defaults: Attrs<'a>,
spans: Vec<(usize, usize, Attrs<'a>)>,