diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index 923dd73a16ab..36eb71a67298 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -342,9 +342,6 @@ 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 diff --git a/helix-tui/src/buffer.rs b/helix-tui/src/buffer.rs index b1fd44787f78..c2b4c4211a9b 100644 --- a/helix-tui/src/buffer.rs +++ b/helix-tui/src/buffer.rs @@ -510,9 +510,13 @@ impl Buffer { pub fn clear_with(&mut self, area: Rect, style: Style) { for x in area.left()..area.right() { for y in area.top()..area.bottom() { - let cell = &mut self[(x, y)]; - cell.reset(); - cell.set_style(style); + if let Some(cell) = &mut self.get_mut(x, y) { + cell.reset(); + cell.set_style(style); + } else { + // Skip this render if the window size has changed + return; + } } } } diff --git a/helix-view/src/graphics.rs b/helix-view/src/graphics.rs index a0b645fae5b8..e813fb5604b8 100644 --- a/helix-view/src/graphics.rs +++ b/helix-view/src/graphics.rs @@ -237,8 +237,8 @@ impl Rect { Rect { x: x1, y: y1, - width: x2 - x1, - height: y2 - y1, + width: x2.saturating_sub(x1), + height: y2.saturating_sub(y1), } }