mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
TextArea: fix cursor after content change
This commit is contained in:
parent
70906aa5de
commit
fdf4a0db4b
@ -66,6 +66,7 @@ impl TextArea {
|
|||||||
/// Sets the content of the view.
|
/// Sets the content of the view.
|
||||||
pub fn set_content<S: Into<String>>(&mut self, content: S) {
|
pub fn set_content<S: Into<String>>(&mut self, content: S) {
|
||||||
self.content = content.into();
|
self.content = content.into();
|
||||||
|
self.cursor = min(self.cursor, self.content.len());
|
||||||
if let Some(size) = self.size_cache.map(|s| s.map(|s| s.value)) {
|
if let Some(size) = self.size_cache.map(|s| s.map(|s| s.value)) {
|
||||||
self.compute_rows(size);
|
self.compute_rows(size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user