chore: update gpui & components
This commit is contained in:
@@ -42,14 +42,19 @@ impl LineItem {
|
||||
/// After use lines to calculate the scroll size of the Editor.
|
||||
pub(super) struct TextWrapper {
|
||||
text: Rope,
|
||||
|
||||
/// Total wrapped lines (Inlucde the first line), value is start and end index of the line.
|
||||
soft_lines: usize,
|
||||
font: Font,
|
||||
font_size: Pixels,
|
||||
|
||||
/// If is none, it means the text is not wrapped
|
||||
wrap_width: Option<Pixels>,
|
||||
|
||||
/// The lines by split \n
|
||||
pub(super) lines: Vec<LineItem>,
|
||||
|
||||
_initialized: bool,
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
@@ -62,6 +67,7 @@ impl TextWrapper {
|
||||
wrap_width,
|
||||
soft_lines: 0,
|
||||
lines: Vec::new(),
|
||||
_initialized: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +92,6 @@ impl TextWrapper {
|
||||
if wrap_width == self.wrap_width {
|
||||
return;
|
||||
}
|
||||
|
||||
self.wrap_width = wrap_width;
|
||||
self.update_all(&self.text.clone(), true, cx);
|
||||
}
|
||||
@@ -95,12 +100,19 @@ impl TextWrapper {
|
||||
if self.font.eq(&font) && self.font_size == font_size {
|
||||
return;
|
||||
}
|
||||
|
||||
self.font = font;
|
||||
self.font_size = font_size;
|
||||
self.update_all(&self.text.clone(), true, cx);
|
||||
}
|
||||
|
||||
pub(super) fn prepare_if_need(&mut self, text: &Rope, cx: &mut App) {
|
||||
if self._initialized {
|
||||
return;
|
||||
}
|
||||
self._initialized = true;
|
||||
self.update_all(text, true, cx);
|
||||
}
|
||||
|
||||
/// Update the text wrapper and recalculate the wrapped lines.
|
||||
///
|
||||
/// If the `text` is the same as the current text, do nothing.
|
||||
|
||||
Reference in New Issue
Block a user