@@ -238,6 +238,9 @@ impl Component for Completion {
238 .language()
238 .language()
239 .and_then(|scope| scope.strip_prefix("source."))
239 .and_then(|scope| scope.strip_prefix("source."))
240 .unwrap_or("");
240 .unwrap_or("");
241+ let cursor_pos = doc.selection(view.id).cursor();
243+ helix_core::coords_at_pos(doc.text().slice(..), cursor_pos).row - view.first_line;
242 let doc = match &option.documentation {
245 let doc = match &option.documentation {
243 Some(lsp::Documentation::String(contents))
246 Some(lsp::Documentation::String(contents))
@@ -289,8 +292,14 @@ impl Component for Completion {
290 let half = area.height / 2;
293 let half = area.height / 2;
291 let height = 15.min(half);
294 let height = 15.min(half);
295+ let y = if cursor_pos > half as usize {
292− // -2 to subtract command line + statusline. a bit of a hack, because of splits.
298+ // -2 to subtract command line + statusline. a bit of a hack, because of splits.
299+ area.height.saturating_sub(height).saturating_sub(2)
293− let area = Rect::new(0, area.height - height - 2, area.width, height);
302+ let area = Rect::new(0, y, area.width, height);
295 // clear area
304 // clear area
296 let background = cx.editor.theme.get("ui.popup");
305 let background = cx.editor.theme.get("ui.popup");