aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/markdown.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs
index 923dd73a..87136992 100644
--- a/helix-term/src/ui/markdown.rs
+++ b/helix-term/src/ui/markdown.rs
@@ -342,13 +342,10 @@ impl Component for Markdown {
fn required_size(&mut self, viewport: (u16, u16)) -> Option<(u16, u16)> {
let padding = 2;
- if padding >= viewport.1 || padding >= viewport.0 {
- return None;
- }
let contents = self.parse(None);
// TODO: account for tab width
- let max_text_width = (viewport.0 - padding).min(120);
+ let max_text_width = (viewport.0.saturating_sub(padding)).min(120);
let (width, height) = crate::ui::text::required_size(&contents, max_text_width);
Some((width + padding, height + padding))