Fix u16 overflow

This commit is contained in:
sxyazi 2023-11-10 09:33:19 +08:00
parent 7f0f6afafb
commit 00c7e01d88
No known key found for this signature in database

View file

@ -38,7 +38,12 @@ impl<'a> Widget for Completion<'a> {
let input_area = self.cx.area(&self.cx.input.position);
let mut area = self.cx.area(&Position::Sticky(
Rect { x: 1, y: 0, width: input_area.width - 2, height: items.len() as u16 + 2 },
Rect {
x: 1,
y: 0,
width: input_area.width.saturating_sub(2),
height: items.len() as u16 + 2,
},
input_area,
));