Refactor of scroll and shaping
- Scroll is identified by line index and layout index, instead of just layout index - Shaping has the option to prune, where caches outside of the scroll view are cleared - Syntax editor no longer requires layout of all lines, only of lines inside scroll - BufferLine has a metadata field that can be used by other abstractions to know when text was changed
This commit is contained in:
parent
e7261fc06e
commit
d0b4b4635e
16 changed files with 213 additions and 159 deletions
|
|
@ -94,12 +94,13 @@ impl Edit for Editor {
|
|||
}
|
||||
}
|
||||
|
||||
fn shape_as_needed(&mut self, font_system: &mut FontSystem) {
|
||||
fn shape_as_needed(&mut self, font_system: &mut FontSystem, prune: bool) {
|
||||
if self.cursor_moved {
|
||||
self.buffer.shape_until_cursor(font_system, self.cursor);
|
||||
self.buffer
|
||||
.shape_until_cursor(font_system, self.cursor, prune);
|
||||
self.cursor_moved = false;
|
||||
} else {
|
||||
self.buffer.shape_until_scroll(font_system);
|
||||
self.buffer.shape_until_scroll(font_system, prune);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -627,7 +628,7 @@ impl Edit for Editor {
|
|||
}
|
||||
Action::Scroll { lines } => {
|
||||
let mut scroll = self.buffer.scroll();
|
||||
scroll += lines;
|
||||
scroll.layout += lines;
|
||||
self.buffer.set_scroll(scroll);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue