aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/popup.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-08-19 02:25:19 +0000
committerBlaž Hrastnik2021-08-19 02:25:19 +0000
commit12ea3888c59aec8e6d0b4dcf6a3ad92a84edaca7 (patch)
tree42e2babe2d92ec5bc8a8bd2f44f0b0e4d37f540a /helix-term/src/ui/popup.rs
parent466528c49308f3e326f97eb65155650b3f78735b (diff)
fix: ui: Pin popups with no positioning to the initial cursor position
This avoids the floating popup following the cursor as we type.
Diffstat (limited to 'helix-term/src/ui/popup.rs')
-rw-r--r--helix-term/src/ui/popup.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs
index e31d4d7b..e126c845 100644
--- a/helix-term/src/ui/popup.rs
+++ b/helix-term/src/ui/popup.rs
@@ -110,8 +110,7 @@ impl<T: Component> Component for Popup<T> {
let position = self
.position
- .or_else(|| cx.editor.cursor().0)
- .unwrap_or_default();
+ .get_or_insert_with(|| cx.editor.cursor().0.unwrap_or_default());
let (width, height) = self.size;