on master help sign in
Use full screen size
commit0882712b4598586ce7c9b8e8f446d6a6fc5ff060 authorwojciechkepka <wojtek.kepka@protonmail.com> dateSun 20 Jun 2021, 07:15 (5 years ago) parent980e602
2 files changed+9−3
helix-term/src/ui/completion.rs+5−3 helix-view/src/tree.rs+4
helix-term/src/ui/completion.rs+5−3
@@ -239,8 +239,8 @@ impl Component for Completion {
239239 .and_then(|scope| scope.strip_prefix("source."))
240240 .unwrap_or("");
241241 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;
244244
245245 let doc = match &option.documentation {
246246 Some(lsp::Documentation::String(contents))
@@ -292,7 +292,9 @@ impl Component for Completion {
292292
293293 let half = area.height / 2;
294294 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+ {
296298 0
297299 } else {
298300 // -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 {
434434 self.focus = key;
435435 }
436436 }
437+
438+ pub fn area(&self) -> Rect {
439+ self.area
440+ }
437441}
438442
439443#[derive(Debug)]