on master help sign in
Fix documentation popup panic
4dbc23fwojciechkepka
helix-term/src/ui/popup.rs+2−2
@@ -125,13 +125,13 @@ impl<T: Component> Component for Popup<T> {
125 let mut rel_x = position.col as u16;
125 let mut rel_x = position.col as u16;
126 let mut rel_y = position.row as u16;
126 let mut rel_y = position.row as u16;
127 if viewport.width <= rel_x + width {
127 if viewport.width <= rel_x + width {
128− rel_x -= ((rel_x + width) - viewport.width)
128+ rel_x = rel_x.saturating_sub((rel_x + width).saturating_sub(viewport.width));
129 };
129 };
130
130
131 // TODO: be able to specify orientation preference. We want above for most popups, below
131 // TODO: be able to specify orientation preference. We want above for most popups, below
132 // for menus/autocomplete.
132 // for menus/autocomplete.
133 if height <= rel_y {
133 if height <= rel_y {
134− rel_y -= height // position above point
134+ rel_y = rel_y.saturating_sub(height) // position above point
135 } else {
135 } else {
136 rel_y += 1 // position below point
136 rel_y += 1 // position below point
137 }
137 }