on master help sign in
Fix documentation popup panic
commit4dbc23ff1ca0c3cc601c6ea011d4ec0a294dd7b2 authorwojciechkepka <wojtek.kepka@protonmail.com> dateWed 9 Jun 2021, 18:21 (5 years ago) parentb20e4a1
1 file changed+2−2
helix-term/src/ui/popup.rs+2−2
helix-term/src/ui/popup.rs+2−2
@@ -125,13 +125,13 @@ impl<T: Component> Component for Popup<T> {
125125 let mut rel_x = position.col as u16;
126126 let mut rel_y = position.row as u16;
127127 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));
129129 };
130130
131131 // TODO: be able to specify orientation preference. We want above for most popups, below
132132 // for menus/autocomplete.
133133 if height <= rel_y {
134− rel_y -= height // position above point
134+ rel_y = rel_y.saturating_sub(height) // position above point
135135 } else {
136136 rel_y += 1 // position below point
137137 }