fix: Allow multi-line prompt documentation

This commit is contained in:
Blaž Hrastnik 2022-02-20 14:44:44 +09:00
parent a449156702
commit 2af04325d8
No known key found for this signature in database
GPG key ID: 1238B9C4AD889640
3 changed files with 30 additions and 19 deletions

View file

@ -247,19 +247,8 @@ impl Component for Markdown {
// TODO: account for tab width
let max_text_width = (viewport.0 - padding).min(120);
let mut text_width = 0;
let mut height = padding;
for content in contents {
height += 1;
let content_width = content.width() as u16;
if content_width > max_text_width {
text_width = max_text_width;
height += content_width / max_text_width;
} else if content_width > text_width {
text_width = content_width;
}
}
let (width, height) = crate::ui::text::required_size(&contents, max_text_width);
Some((text_width + padding, height))
Some((width + padding * 2, height))
}
}