on master help sign in
Use full screen size
0882712wojciechkepka
helix-term/src/ui/completion.rs+5−3
@@ -239,8 +239,8 @@ impl Component for Completion {
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();
241 let cursor_pos = doc.selection(view.id).cursor();
242− let cursor_pos =
243− helix_core::coords_at_pos(doc.text().slice(..), cursor_pos).row - view.first_line;
242+ let cursor_pos = (helix_core::coords_at_pos(doc.text().slice(..), cursor_pos).row
243+ - view.first_line) as u16;
244
244
245 let doc = match &option.documentation {
245 let doc = match &option.documentation {
246 Some(lsp::Documentation::String(contents))
246 Some(lsp::Documentation::String(contents))
@@ -292,7 +292,9 @@ impl Component for Completion {
292
292
293 let half = area.height / 2;
293 let half = area.height / 2;
294 let height = 15.min(half);
294 let height = 15.min(half);
295− let y = if cursor_pos > half as usize {
295+ let y = if cursor_pos + view.area.y
296+ >= (cx.editor.tree.area().height - height - 1/* statusline */)
297+ {
296 0
298 0
297 } else {
299 } else {
298 // -2 to subtract command line + statusline. a bit of a hack, because of splits.
300 // -2 to subtract command line + statusline. a bit of a hack, because of splits.
helix-view/src/tree.rs+4
@@ -434,6 +434,10 @@ impl Tree {
434 self.focus = key;
434 self.focus = key;
435 }
435 }
436 }
436 }
437+
438+ pub fn area(&self) -> Rect {
439+ self.area
440+ }
437}
441}
438
442
439#[derive(Debug)]
443#[derive(Debug)]