aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-23 04:13:56 +0000
committerBlaž Hrastnik2021-06-23 04:13:56 +0000
commit9706f1121de673950d8e0472062a32f18d527ad2 (patch)
tree26a3e5c42b1b435799286091089ef3e0c08d78e3
parent2ff9b362fb3e0c54cc0172f826d5f78ba398af57 (diff)
Fix small screen panics
-rw-r--r--helix-term/src/ui/prompt.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 07f360e5..c40be1a2 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -279,7 +279,7 @@ impl Prompt {
let height = ((self.completion.len() as u16 + cols - 1) / cols)
.min(10) // at most 10 rows (or less)
- .min(area.height);
+ .min(area.height.saturating_sub(1));
let completion_area = Rect::new(
area.x,
@@ -331,7 +331,7 @@ impl Prompt {
let viewport = area;
let area = viewport.intersection(Rect::new(
completion_area.x,
- completion_area.y - 3,
+ completion_area.y.saturating_sub(3),
BASE_WIDTH * 3,
3,
));