fix: ui: Pin popups with no positioning to the initial cursor position

This avoids the floating popup following the cursor as we type.
This commit is contained in:
Blaž Hrastnik 2021-08-19 11:25:19 +09:00
parent 466528c493
commit 12ea3888c5

View file

@ -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;