Improvements to syntax editor, integrate with libcosmic editor

This commit is contained in:
Jeremy Soller 2022-11-09 10:44:51 -07:00
parent 1663bfc96c
commit bbe7d77b7b
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE
9 changed files with 386 additions and 69 deletions

View file

@ -145,8 +145,9 @@ impl fmt::Display for Metrics {
/// A buffer of text that is shaped and laid out
pub struct Buffer<'a> {
font_system: &'a FontSystem,
/// Lines (or paragraphs) of text in the buffer
/// The [FontSystem] used by this [Buffer]
pub font_system: &'a FontSystem,
/// [BufferLine]s (or paragraphs) of text in the buffer
pub lines: Vec<BufferLine>,
metrics: Metrics,
width: i32,
@ -365,14 +366,10 @@ impl<'a> Buffer<'a> {
/// Set the current buffer dimensions
pub fn set_size(&mut self, width: i32, height: i32) {
if width != self.width {
if width != self.width || height != self.height {
self.width = width;
self.relayout();
self.shape_until_scroll();
}
if height != self.height {
self.height = height;
self.relayout();
self.shape_until_scroll();
}
}