From fdf4a0db4b3d1250bbab3363df33722f663e2b8d Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Thu, 7 Dec 2017 13:48:41 -0800 Subject: [PATCH] TextArea: fix cursor after content change --- src/views/text_area.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/views/text_area.rs b/src/views/text_area.rs index 1717791..7589615 100644 --- a/src/views/text_area.rs +++ b/src/views/text_area.rs @@ -66,6 +66,7 @@ impl TextArea { /// Sets the content of the view. pub fn set_content>(&mut self, content: S) { 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)) { self.compute_rows(size); }