mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 11:16:03 +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")
|
.title("Describe your issue")
|
||||||
.padding((1, 1, 1, 0))
|
.padding((1, 1, 1, 0))
|
||||||
.content(TextArea::new()
|
.content(TextArea::new()
|
||||||
.with_id("text")
|
.with_id("text"))
|
||||||
.fixed_size((30, 5)))
|
|
||||||
.button("Ok", Cursive::quit));
|
.button("Ok", Cursive::quit));
|
||||||
|
|
||||||
siv.run();
|
siv.run();
|
||||||
|
@ -366,7 +366,7 @@ impl View for TextArea {
|
|||||||
fn required_size(&mut self, constraint: Vec2) -> Vec2 {
|
fn required_size(&mut self, constraint: Vec2) -> Vec2 {
|
||||||
self.compute_rows(constraint);
|
self.compute_rows(constraint);
|
||||||
Vec2::new(
|
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()
|
self.rows.len()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user