mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Invalidate TextView cache on content change
This commit is contained in:
parent
2860467f29
commit
455a2a817c
@ -96,6 +96,7 @@ impl TextView {
|
||||
pub fn set_content(&mut self, content: &str) {
|
||||
let content = strip_last_newline(content);
|
||||
self.content = content.to_string();
|
||||
self.invalidate();
|
||||
}
|
||||
|
||||
/// Returns the current text in this view.
|
||||
@ -153,6 +154,11 @@ impl TextView {
|
||||
self.last_size = Some(size);
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidates the cache, so next call will recompute everything.
|
||||
fn invalidate(&mut self) {
|
||||
self.last_size = None;
|
||||
}
|
||||
}
|
||||
|
||||
// Given a multiline string, and a given maximum width,
|
||||
|
Loading…
Reference in New Issue
Block a user