mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-10 03:10:41 +00:00
TextArea: fix off-by-one required_size
This commit is contained in:
parent
3ec0eb3ff4
commit
2fd30e3e10
@ -11,8 +11,7 @@ fn main() {
|
||||
.title("Describe your issue")
|
||||
.padding((1, 1, 1, 0))
|
||||
.content(TextArea::new()
|
||||
.with_id("text")
|
||||
.fixed_size((30, 5)))
|
||||
.with_id("text"))
|
||||
.button("Ok", Cursive::quit));
|
||||
|
||||
siv.run();
|
||||
|
@ -366,7 +366,7 @@ impl View for TextArea {
|
||||
fn required_size(&mut self, constraint: Vec2) -> Vec2 {
|
||||
self.compute_rows(constraint);
|
||||
Vec2::new(
|
||||
self.rows.iter().map(|r| r.width).max().unwrap_or(1),
|
||||
1 + self.rows.iter().map(|r| r.width).max().unwrap_or(1),
|
||||
self.rows.len()
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user