aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorwojciechkepka2021-06-09 16:21:58 +0000
committerBlaž Hrastnik2021-06-10 02:26:03 +0000
commit4dbc23ff1ca0c3cc601c6ea011d4ec0a294dd7b2 (patch)
tree62dfadda0ab2d4c338d43c41daebfbf7dbb0c206 /helix-term/src
parentb20e4a108cd890afa6cdf83656856fc2157a8e84 (diff)
Fix documentation popup panic
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/popup.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs
index 015d5c9b..ca349403 100644
--- a/helix-term/src/ui/popup.rs
+++ b/helix-term/src/ui/popup.rs
@@ -125,13 +125,13 @@ impl<T: Component> Component for Popup<T> {
let mut rel_x = position.col as u16;
let mut rel_y = position.row as u16;
if viewport.width <= rel_x + width {
- rel_x -= ((rel_x + width) - viewport.width)
+ rel_x = rel_x.saturating_sub((rel_x + width).saturating_sub(viewport.width));
};
// TODO: be able to specify orientation preference. We want above for most popups, below
// for menus/autocomplete.
if height <= rel_y {
- rel_y -= height // position above point
+ rel_y = rel_y.saturating_sub(height) // position above point
} else {
rel_y += 1 // position below point
}