on master help sign in
Fix crash when too many completions available
8372395Blaž Hrastnik
helix-term/src/ui/prompt.rs+4−1
@@ -127,7 +127,10 @@ impl Prompt {
127 // completion
127 // completion
128
128
129 let max_col = std::cmp::max(1, area.width / BASE_WIDTH);
129 let max_col = std::cmp::max(1, area.width / BASE_WIDTH);
130− let height = ((self.completion.len() as u16 + max_col - 1) / max_col);
130+ let height = ((self.completion.len() as u16 + max_col - 1) / max_col)
131+ .min(10) // at most 10 rows (or less)
132+ .min(area.height);
133+
131 let completion_area = Rect::new(
134 let completion_area = Rect::new(
132 area.x,
135 area.x,
133 (area.height - height).saturating_sub(1),
136 (area.height - height).saturating_sub(1),