Grow horizontally as well

This commit is contained in:
Markus Unterwaditzer 2017-04-21 23:58:19 +02:00
parent 14cfe3604a
commit 065789c286

View File

@ -364,7 +364,10 @@ impl TextArea {
impl View for TextArea { 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(1, self.rows.len()) Vec2::new(
self.rows.iter().map(|r| r.width).max().unwrap_or(1),
self.rows.len()
)
} }
fn draw(&self, printer: &Printer) { fn draw(&self, printer: &Printer) {