on master help sign in
Fix 'attempt to divide by zero' panic (#6155)
ddc5bf4nuid32
helix-term/src/ui/text.rs+1−1
@@ -58,7 +58,7 @@ pub fn required_size(text: &tui::text::Text, max_text_width: u16) -> (u16, u16)
58 let content_width = content.width() as u16;
58 let content_width = content.width() as u16;
59 if content_width > max_text_width {
59 if content_width > max_text_width {
60 text_width = max_text_width;
60 text_width = max_text_width;
61− height += content_width / max_text_width;
61+ height += content_width.checked_div(max_text_width).unwrap_or(0);
62 } else if content_width > text_width {
62 } else if content_width > text_width {
63 text_width = content_width;
63 text_width = content_width;
64 }
64 }