Skip to content

Commit

Permalink
Fix crash when too many completions available
Browse files Browse the repository at this point in the history
Refs #81
  • Loading branch information
archseer committed Jun 8, 2021
1 parent ae51065 commit 8372395
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helix-term/src/ui/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ impl Prompt {
// completion

let max_col = std::cmp::max(1, area.width / BASE_WIDTH);
let height = ((self.completion.len() as u16 + max_col - 1) / max_col);
let height = ((self.completion.len() as u16 + max_col - 1) / max_col)
.min(10) // at most 10 rows (or less)
.min(area.height);

let completion_area = Rect::new(
area.x,
(area.height - height).saturating_sub(1),
Expand Down

0 comments on commit 8372395

Please sign in to comment.