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:
Jeremy Soller 2023-12-15 13:37:59 -07:00
parent e7261fc06e
commit d0b4b4635e
16 changed files with 213 additions and 159 deletions

View file

@ -291,8 +291,8 @@ impl<'a> Edit for ViEditor<'a> {
self.editor.set_tab_width(tab_width);
}
fn shape_as_needed(&mut self, font_system: &mut FontSystem) {
self.editor.shape_as_needed(font_system);
fn shape_as_needed(&mut self, font_system: &mut FontSystem, prune: bool) {
self.editor.shape_as_needed(font_system, prune);
}
fn delete_range(&mut self, start: Cursor, end: Cursor) {
@ -443,8 +443,8 @@ impl<'a> Edit for ViEditor<'a> {
editor.insert_at(cursor, "\n", None);
editor.insert_at(cursor, data, None);
// Hack to allow immediate up/down
editor.shape_as_needed(font_system);
//TODO: Hack to allow immediate up/down
editor.shape_as_needed(font_system, false);
// Move to inserted line, preserving cursor x position
if after {