fix: shape_until_scroll if a buffer_line is modified
This commit is contained in:
parent
5651c2d967
commit
1abcf67e17
3 changed files with 14 additions and 0 deletions
|
|
@ -426,6 +426,11 @@ impl Buffer {
|
|||
fn resolve_dirty(&mut self) -> bool {
|
||||
let dirty = self.dirty;
|
||||
if dirty.is_empty() {
|
||||
// individual lines may have been externally invalidated
|
||||
if self.lines.iter().any(|line| line.needs_reshaping()) {
|
||||
self.redraw = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -236,6 +236,10 @@ impl BufferLine {
|
|||
self.shape_opt.get()
|
||||
}
|
||||
|
||||
pub const fn needs_reshaping(&self) -> bool {
|
||||
self.shape_opt.is_invalidated() || self.layout_opt.is_invalidated()
|
||||
}
|
||||
|
||||
/// Layout line, will cache results
|
||||
#[allow(clippy::missing_panics_doc)]
|
||||
pub fn layout(
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ impl<T: Clone + Debug> Cached<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Checks if the value was previously cached but has been invalidated.
|
||||
pub const fn is_invalidated(&self) -> bool {
|
||||
matches!(self, Self::Unused(_))
|
||||
}
|
||||
|
||||
/// Takes the buffered value if in state `Self::Unused`.
|
||||
pub fn take_unused(&mut self) -> Option<T> {
|
||||
if matches!(*self, Self::Unused(_)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue