Skip to content

Commit

Permalink
Use full screen size
Browse files Browse the repository at this point in the history
  • Loading branch information
vv9k committed Jun 20, 2021
1 parent 4b6b55c commit 781adde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions helix-term/src/ui/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ impl Component for Completion {
.and_then(|scope| scope.strip_prefix("source."))
.unwrap_or("");
let cursor_pos = doc.selection(view.id).cursor();
let cursor_pos =
helix_core::coords_at_pos(doc.text().slice(..), cursor_pos).row - view.first_line;
let cursor_pos = (helix_core::coords_at_pos(doc.text().slice(..), cursor_pos).row
- view.first_line) as u16;

let doc = match &option.documentation {
Some(lsp::Documentation::String(contents))
Expand Down Expand Up @@ -292,7 +292,9 @@ impl Component for Completion {

let half = area.height / 2;
let height = 15.min(half);
let y = if cursor_pos > half as usize {
let y = if cursor_pos + view.area.y
>= (cx.editor.tree.area().height - height - 1/* statusline */)
{
0
} else {
// -2 to subtract command line + statusline. a bit of a hack, because of splits.
Expand Down
4 changes: 4 additions & 0 deletions helix-view/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ impl Tree {
self.focus = key;
}
}

pub fn area(&self) -> Rect {
self.area
}
}

#[derive(Debug)]
Expand Down

0 comments on commit 781adde

Please sign in to comment.