diff options
author | Blaž Hrastnik | 2022-02-20 05:44:44 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-02-20 05:44:44 +0000 |
commit | 2af04325d83cd0141400951252574666cffdf1af (patch) | |
tree | 5ead25957fa265638d9714e0d7c8568d75261035 /helix-term/src/ui/markdown.rs | |
parent | a449156702112a1ee1d11ef2f5495067d801deef (diff) |
fix: Allow multi-line prompt documentation
Diffstat (limited to 'helix-term/src/ui/markdown.rs')
-rw-r--r-- | helix-term/src/ui/markdown.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index 6a7b641a..cfb5998c 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -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)) } } |